Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Hibernate What?s the difference between load() and get()?
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Java Coder
What?s the difference between load() and get()?
1 Answer(s)      a year and 8 months ago
Posted in : Hibernate


Hi,

What?s the difference between load() and get()?

thanks,


Advertisement
View Answers

April 18, 2013 at 7:00 PM


hi friend,

  1. 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.
  2. 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.
  3. 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:
Advertisements
 

 

 

DMCA.com