What?s the difference between load() and get()?
Hi,
What?s the difference between load() and get()?
thanks,
View Answers
April 18, 2013 at 7:00 PM
hi friend,
- get() returns the real object
fetched directly from the database
whereas, load() returns proxy object
which is a temporary fake object,
which may or may not exist in
database.
- load() method should be used if the
existence of object is sure whereas,
get() method should by used if the
existence of object is not sure.
- load() method throws an exception if
unique id is not found whereas,
get() method returns null if unique
id is not found
For more detail please go through the following link may, this will be helpful for you.
http://www.roseindia.net/hibernate/hibernate4/hibernate_get.shtml
Related Tutorials/Questions & Answers: