Hi All
I have 2 objects. I have a Parent class and a children class. This is a one-to-many relation. The parent has 0 or more children.
The mapping works fine but the problem is I need to filter the children set. For example:
The database has 1 parent (Parent1) and 3 children (Child1, Child2, Child3). When I execute the HQL query:
select P1 from Parent P1 LEFT JOIN Child C1 WHERE C1.Nae='Child2'
I get 1 parent object. That is correct but the children set in the parent object contains 3 children. This is correct. I would like to know how can I initialize the children set so that only children with a certain name are loaded into the set.
I must advise. I'm using spring so I am using getHibernateTemplate() and not the session object to execute queries.
Any help would be appreciated.
Thanks
|