-->
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.  [ 1 post ] 
Author Message
 Post subject: Duplicate objects returned with eager fetching
PostPosted: Mon Apr 28, 2008 9:09 am 
Beginner
Beginner

Joined: Sun Oct 14, 2007 7:29 pm
Posts: 23
I have run into the situation where I am getting multiple duplicate objects back from a query, and based on the below exerpt from the reference guide, it appears this may be due to eager fetching.
Quote:
Note that queries that make use of eager fetching of collections usually return duplicates of the root objects (but with their collections initialized). You can filter these duplicates simply through a Set.


My question is, how does one do this filtering it refers to through a Set? Also, do I prevent this by simply setting lazy="true" for my associations, or is my problem the fact that I am using "fetch" in my HQL:
Code:
select usrprof from Usrprofiles as usrprof left join fetch usrprof.usrmsgses  where (usrprof.username="johndoe" and usrprof.usrmsgses.viewed=false) order by usrprof.usrmsgses.logDate desc


Thanks,

-Matt


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

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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.