-->
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.  [ 3 posts ] 
Author Message
 Post subject: Which is efficient to use?
PostPosted: Thu Mar 11, 2010 1:03 am 
Newbie

Joined: Thu Mar 11, 2010 12:55 am
Posts: 4
I have list of ids and need to load the objects.
Is it preferable to use IN or load them as separate objects using get by Id?
Or is there any other efficient way?

Any suggestions would be helpful


Top
 Profile  
 
 Post subject: Re: Which is efficient to use?
PostPosted: Thu Mar 11, 2010 1:56 am 
Newbie

Joined: Wed Jan 23, 2008 7:45 am
Posts: 14
Location: Pune,India
IN is definitely a better way since Hibernate will pick all the objects up in one go. 'get' will hit the DB one by one hitting performance.

_________________
Harshal Vaidya


Top
 Profile  
 
 Post subject: Re: Which is efficient to use?
PostPosted: Thu Mar 11, 2010 2:23 am 
Senior
Senior

Joined: Wed Sep 19, 2007 9:31 pm
Posts: 191
Location: Khuntien (Indonesia)
If you want to load some object to set into the many-to-one relationship,
you can use load instead of get


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.