It is my understanding that there used to be one collection(per level) eager fetch restriction in Hibernate2 and that has been removed in Hibernate3.
Does that mean Hibernate3 still defaults to 1 collection fetch for backward compatibility? If that is, Can anyone point me the property to set the appropriate values?
Currently, I am trying to eager fetch 2 different collections from an object in order to avoid n+1 select issue with Hibernate. I have a class Company that has 1 to many relationship with employee and partner objects.
In my HQL I have defined " from Company c left join fetch c.partner left join fetch c.employee where...."
When I turn on show_sql, I am still seeing the select query run n times for the the retrieval of employee. If i change the HQL so that employee is before partner, I now see query for getting partners executed n times?
Thanks in advance
Thapa
|