-->
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: performance related questions in find/load/get
PostPosted: Tue Feb 03, 2004 5:18 pm 
Beginner
Beginner

Joined: Tue Nov 18, 2003 12:34 am
Posts: 39
Location: Dallas, Texas, US
Please allow me to ask these basic questions in the search functions with a with performance perspective.

I understand the basic differences between the methods find(), load(), and get() (which is the upfront knowledge of the id). Thinkng of performance, I have these questions:

1. Does find() do the same as that of load() in terms of locking the tables in a JDBC transaction and performing?

2. The docs says

"If you are not certain that a matching row exists, you should use the get() method, which hits the database immediately and returns null if there is no matching row"

How is this different from a find()?


Thanks,
Madhan.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 03, 2004 6:54 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
find() and load() may return proxys.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 04, 2004 5:17 pm 
Beginner
Beginner

Joined: Tue Nov 18, 2003 12:34 am
Posts: 39
Location: Dallas, Texas, US
So, can I safely assume that get() may hinder performance as it does not use proxys? Or is there any other special case where I can only use a get() and not load().

Similarly, load() sounds like an efficient way over to find() as it loads only one object where as a find() may return many objects most of them not required. I am doing a load() after getting the id from find() as I think the extra results can be safely garbage collected this way. Is this an advisable practice?

Thanks.


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.