What is the difference between load() and get() method?

Answer

load(): 

- Use load() method only when you are sure that object you want to read already exists. 
- If unique Id of an object does not exists in database then load() method will throw an exception.
- load() method return proxy object default and database won't be hit until the proxy is first invoked.

get():

- Use get() method when you are not sure obout the object existance in the database.
- If object does not exists in the database, the get() method will return null.
- get() method will hit database immediately.

All hibernate Questions

Ask your interview questions on hibernate

Write Your comment or Questions if you want the answers on hibernate from hibernate Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---