Load and Get Method in hibernate







What   is  difference between   Load()  and   get ()  method ? 
  

By default, hibernate creates run-time proxies. It loads the objects as a proxy unless a fetch mode is specified or set to false.

That's because once the object is loaded in cache, the next subsequent calls perform repeatable read.
Although the state of this object changes from persistent to detached
The entity can be retrieved in 2 ways.


a) load() - returns the proxy object with an identifier. Its  load  fake object in cash not data. It does not hit database.Throws NoObjectFoundException 

 if no row found.


b)get() - returns the complete object from database. It loads the object in the cache once call this method.Its hit database to load object , returns Null if 

no row found .
Load and Get Method in hibernate Load and Get Method in hibernate Reviewed by Mukesh Jha on 10:29 AM Rating: 5

No comments:

Add your comment

All Right Reserved To Mukesh Jha.. Theme images by Jason Morrow. Powered by Blogger.