title: Grails: "Not in aggregate function" problem with HQL query
body: <p>Querying by HQL with</p>
  
  <pre><code>select a from Article a join a.tags t 
  where t.name in (:tags) 
  group by a 
  having count(t)=:tag_count
  </code></pre>
  
  <p>using HSQLDB in Grails produces an SqlException "Not in aggregate function...". Looking at the generated SQL provides</p>
  
  <pre><code>SELECT a.id, a.title, a.url, ....
  ..
  GROUP BY a.id
  HAVING ..
  </code></pre>
  
  <p>In some MySQL products this works, I have heard, but apparently not in HSQLDB. I don't understand:</p>
  
  <ol>
  <li>Why does Hibernate generate faulty SQL? Or does it not?</li>
  <li>Why is HSQLDB not allowing the grouping on <em>just</em> the id while selecting the lot, I mean its the primary key after all and my SELECT does not introduce indeterministic values such as a random or current time</li>
  </ol>