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