My object model consists of a Step object which contains a collection of sub-steps and a collection of assistance.
Step and sub-steps have a one to many relationship.
Step and client assistance have a many to many relationship.
In my application a user always gets the sub-steps, but he/she might also request the client assistance. So in my query I am eagerly fetching the sub-steps since I want all the steps -based on some other criteria - regardless of whether they have a parent step or not. But since hibernate restricts the number of eager fetches to one, I'd like to know how you can go about loading the client assistance collection. At the present time, I iterate through each step and then call:
step.getClientAssistance().iterator();
But obviously this is not the most optimized way of doing it because if I have 100 steps, then there will be 100 queries to get the assistance out of the assistance table
I am using hibernate version 2.1
Thanks
|