Children is a collection (let's say it is a set.) Each element in this collection has a status property which can be
1="child present" or 0="child deleted"
Can you please tell me how to fetch the parent and all the "present" children? I cannot navigate the association because my session is closed and I can't open it. I have tried to use "with" and fetch in the same HQL but Hibernate gives me an exception. I would like to use only 1 HQL select.
how about following:
select p from Parent p left join fetch p.children child where child.status='present'
Joined: Jul 08, 2010
Thanks for posting. The solution is good but I doesn't solve my problem because I would like to fetch all the parents (it must return parent objects), and inside each parent only the status="present" children.
The posted query gives me the parents that have children with status="present" (and also fetches those childrens).