-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Eager fetching of collections
PostPosted: Fri May 11, 2007 2:35 pm 
Beginner
Beginner

Joined: Fri Apr 13, 2007 9:27 am
Posts: 33
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


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 14, 2007 8:38 am 
Beginner
Beginner

Joined: Fri Apr 13, 2007 9:27 am
Posts: 33
Someone got to know the answer.

I thought eager fetching of collections would be a common task for any web app.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.