Querying by HQL with
select a from Article a join a.tags t
where t.name in (:tags)
group by a
having count(t)=:tag_count
using HSQLDB in Grails produces an SqlException "Not in aggregate function...". Looking at the generated SQL provides
SELECT a.id, a.title, a.url, ....
..
GROUP BY a.id
HAVING ..
In some MySQL products this works, I have heard, but apparently not in HSQLDB. I don't understand:
- Why does Hibernate generate faulty SQL? Or does it not?
- Why is HSQLDB not allowing the grouping on just 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