-->
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.  [ 5 posts ] 
Author Message
 Post subject: Session.Load vs Session.CreateCriteria
PostPosted: Thu Nov 17, 2005 3:31 pm 
Regular
Regular

Joined: Tue May 31, 2005 9:55 am
Posts: 67
Is using Session.Load any more performat than using Session.CreateCriteria with an Expression.Eq on the Primary key? I am generalizing my queries, but don't want to do so at the expense of performace.

thanks,
craig


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 17, 2005 3:53 pm 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
Yes, Load is faster. First, there's less parsing and manipulation involved, second, Load can use second-level cache if that is enabled.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 17, 2005 4:50 pm 
Regular
Regular

Joined: Tue May 31, 2005 9:55 am
Posts: 67
Thanks Sergey,

Are you saying that the second-level cache is not used when retrieving objects with CreateCritera?

craig


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 17, 2005 6:36 pm 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
No, only the query cache may be used. The normal second-level cache can only be searched by class and id, so it is only useful for Load/Get and for lazy initialization.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 18, 2005 10:12 am 
Regular
Regular

Joined: Tue May 31, 2005 9:55 am
Posts: 67
Thanks for the clarification.

craig


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