Hello,
i got a problem with a query a bit complicated. To go straigh this is the SQL query i want to get :
select * from Parent parent left join fetch parent.child child left joint fetch child.grandchild grandchild with age < 18;
Child is a collection of Parent, Grandchild a collection of Child
The with clause is forbidden because of the fetch.
So i got to use filters. But I didn't find the way to apply the filter on Grandchild I think this is because the @Filter doesn't appear in the Parent class.
For instant I declare the Filter (@FilterDef) in the Grandchild class, and I put the @Filter(name="age", condition = "age < :age_param) just before the declaration of the Collection<GrandChild> attribute in the Child class .
Is there a way to obtain this query ? am I doing something wrong ?
Thanks for help
|