Get vs Load method in Hibernate - Interview Question

Tutorials Shared by the Internet Community

Synopsis

Both get and load method are used to retrieve object in hibernate but there are subtle difference between them which can affect performance if used at

Statistics

Total Hits - 27225

Total Votes - 138 votes

Vote Up - 68 votes

Vote Down - 70 votes

Domain - javarevisited.blogspot.com

Category - JAVA/Frameworks

Submitted By - Javin Paul

Submitted on - 2012-12-24 15:30:16

Description

Both get and load method are used to retrieve object in hibernate but there are subtle difference between them which can affect performance if used at wrong place. Like get() never return uninitialized object and always hit DB if object is not found in cache but same time it return null if object doesn't exist which can be used to make decisions. ...