Easy learning with example program codes

What is difference between Hibernate Session get() and load() method?


• It will always return a “proxy” in Hibernate terms without hitting the database. In Hibernate, proxy represents a fake object with the given identifier value but its properties are not initialized yet.
• If no record found, it will throws an ObjectNotFoundException.
• Example: Let we call session.load(Employee.class,new Integer(10)). Hibernate will create one fake Employee object [row] in the memory with id 10, but other properties of Employee class will not even be initialized. When we try to retrieve other properties of Employee object, it will hit the database and search the record with employee id 10 and fetch the values. It will throws ObjectNotFoundException in case when no record found.


• It always hit the database and return the real object, an object that represent the database record not proxy.
• It return null if no record found.
• It will not throw any exception in case when no record found.

Industrial Training

We offers Placement Oriented Training on Java, Spring, JSF, Hibernate, PHP, AngularJS, Angular 4, PLSQL, Oracle BI Publisher etc. We also provides Online training, please mail us at


We also provides the Development services for Website Development , Java Development, PHP Development, Android App Development etc. You can contact us on

Copyright © 2019 CodesJava Protection Status SiteMap Reference: Java Wiki