Hibernate Interview Questions

 Load Vs Get

load()get()
Only use load() method if you are sure that the object exists.If you are not sure that the object exist, then use one of get() methods.
load() method will throw an exception if the unique id is not found in the database.get() method will return null if the unique id is not found in the database.
load() just returns a proxy by default and database won't be hit until the proxy is first invoked.get() will hit the database immediately.

Comments

Popular posts from this blog

Java 8 : Find the number starts with 1 from a list of integers

Find Loop in a Linked List

Customized Immutable Class