title: SQL to HQL query Grails
body: <p>I have an SQ: query which I want to use in Grails but need to convert it to HQL so I could use it for findAll method. The code goes like </p>
  
  <pre><code>artifacts = Artifact.findAll(
     "FROM Artifact WHERE id NOT IN ( " +
     "SELECT artifact_id FROM Classification " +
     "WHERE active = :active) AND document_id =:doc_id",
     [active: '1', doc_id:document.id, max:limit, offset:startIndex])
  </code></pre>
  
  <p>This is giving me stringIndexOutofBounds error. I think it s probably because of the syntax because the SQL works fine on the database.</p>