1.

What is the difference between get() and load() methods of session object?

Answer»

There are following differences between get() and load() methods.

  • get() returns null if no data is present where as load throws ObjectNotFoundException exception in such case.

  • get() always hits the database whereas load() method doesn't hit the database.

  • get() returns actual object whereas load() returns proxy object.

  • A central feature of Hibernate, proxies, depends upon the persistent class being either non-final, or the implementation of an interface that declares all public methods.

  • All classes that do not extend or implement some specialized classes and interfaces required by the EJB framework.



Discussion

No Comment Found