title: Not able to run hibernate query because of Syntax exception
body: <p>Query is working properly with MySQL. Can anybody help me to correct the syntax in hibernate?</p>
  
  <pre><code>Query query = entityManager.createQuery("DELETE FROM HierarchyData WHERE id IN (SELECT c.id FROM (SELECT h.id FROM HierarchyData AS h WHERE h.publicId IN (SELECT s.publicId FROM HierarchyData AS s GROUP BY s.publicId HAVING COUNT(s.publicId)&gt;1) AND h.id NOT IN (SELECT m.id FROM HierarchyData AS m GROUP BY m.publicId HAVING COUNT(m.publicId)&gt;1 ORDER BY m.id DESC) ORDER BY h.publicId) AS c)");
  </code></pre>