Hello all:
I am trying to eager fetch a collection of objects. My hql is:
select d.module from PermissionDefinition d left outer join fetch d.module where d.module.moduleId = 1
The above query throw the follwing error:
"query specified join fetching, but the owner of the fetched association was not present in the select list"
If I remove the "fetch" word, it works fine, and the collection of Modules is intialized and accessable outside the session scope.
Now I am confused, because the book and the manual emphasized that we should use the word "fetch" to eager fetch the objects.
Can someone explain why is the discrepancy?
In page 179 in the manual it states the following:
Join fetching - Hibernate retrieves the associated instance or collection in the same SELECT, using an OUTER JOIN.
Does that mean all join operation are eagrly fetched?
Thanks
|