-->
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: Best Practice for finding particular entity in a Collection?
PostPosted: Wed Aug 08, 2007 3:54 pm 
Newbie

Joined: Wed Mar 07, 2007 12:32 pm
Posts: 7
I have two objects related by a one to many. From the one side, I want to find a particular object in the collection based upon an attribute value that can vary per request.

Possibilities include:
- load entire collection and iterate until you find it
- write method with a hql query rather than using collection

We're currently using the second choice above but it still seems wrong. Is there a Hibernate facility that I'm missing that can manage this efficiently?

Thanks,
Jay


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 08, 2007 4:18 pm 
Expert
Expert

Joined: Fri Aug 19, 2005 2:11 pm
Posts: 628
Location: Cincinnati
Not really. But I'd stick with the 2nd choice. Just make sure you aren't using any crazy cartesian joins or anything. Just do a straight select using the required values.

_________________
Chris

If you were at work doing this voluntarily, imagine what you'd want to see to answer a question.


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