I need to select all entity A's where parent entity B has a collection of child entity C with at least one entity.
I think in HQL it ought to be something like this:
Code:
from A a where count(a.B.C) > 0
That is, in SQL:
Code:
SELECT * FROM A a WHERE (SELECT COUNT(*) FROM C c WHERE c.bId = a.bId) > 0
I've read through the HQL documentation offered at
http://www.hibernate.org/hib_docs/reference/en/html/queryhql.html, but my question isn't answered there.
Can anyone advise me, please? I've tried a dozen different variations of HQL that I think might work to no avail.