What is the difference between load() and get()?
Submitted by: Administratorload() vs. get()
load() :-
Only use the load() method if you are sure that the object exists.
load() method will throw an exception 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():-
If you are not sure that the object exists, then use one of the get() methods.
get() method will return null if the unique id is not found in the database.
get() will hit the database immediately.
Submitted by: Administrator
load() :-
Only use the load() method if you are sure that the object exists.
load() method will throw an exception 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():-
If you are not sure that the object exists, then use one of the get() methods.
get() method will return null if the unique id is not found in the database.
get() will hit the database immediately.
Submitted by: Administrator
Read Online Hibernate Job Interview Questions And Answers
Top Hibernate Questions
☺ | How does Hibernate distinguish between transient (i.e. newly instantiated) and detached objects? |
☺ | What is HQL? |
☺ | Why do you need ORM tools like hibernate? |
☺ | What does ORM consists of? |
☺ | What are the general considerations or best practices for defining your Hibernate persistent classes? |
Top Java Programming Language Categories
☺ | Core Java Interview Questions. |
☺ | Hibernate Interview Questions. |
☺ | Advanced Java Interview Questions. |
☺ | IBM WebSphere Interview Questions. |
☺ | Spring Framework Interview Questions. |