-->
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.  [ 4 posts ] 
Author Message
 Post subject: getting list by loop/load vs. in(..)
PostPosted: Sun Jan 02, 2005 7:18 am 
Newbie

Joined: Mon Dec 13, 2004 11:40 am
Posts: 11
Hello all!
in case i get an array of object id's,
will it be true to say that retrieving those objects with hql using
select.. where.. in(list of ids)
is the same as looping on those ids and getting each one of them with
load() ???
i think maybe even the loop/load option is better..
what do you say?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 02, 2005 8:05 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
the in list will have much less database round trips so should be much faster (if you want the concrete objects)

if you use load(id) you wont hit the db before you actually touch the objects properties.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 02, 2005 9:30 am 
Newbie

Joined: Mon Dec 13, 2004 11:40 am
Posts: 11
Thanks!!
is this has something to do with the n+1 problem?
or i just got it all wrong?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 02, 2005 2:19 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
its a variation of that theme yes.

_________________
Max
Don't forget to rate


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