What is the difference between load() and get() method in hibernate?



What is the difference between load() and get() method in hibernate?..

Answer / Dhirendra Pratap

In Hibernate, both load() and get() methods are used to retrieve objects from the database. However, there is a key difference between them:n
1. get(): This method returns a proxy object, which is loaded when one of its properties is accessed.
2. load(): This method also returns a proxy object but it forces loading immediately and returns an initialized object (without waiting for lazy initialization).

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Hibernate Interview Questions

What is query cache in hibernate?

1 Answers  


What is hibernate in spring?

1 Answers  


What is the hibernatetemplate class?

1 Answers  


What is session merge in hibernate?

1 Answers  


What are the extension interfaces that are there in hibernate?

1 Answers  


What is difference between hibernate session get() and load() method?

1 Answers  


What is the difference between save() and persist() methods of session object?

1 Answers  


What are native queries in hibernate?

1 Answers  


What is unidirectional and bidirectional in hibernate mapping?

1 Answers  


What is difference between first level cache and second level cache?

1 Answers  


What is Hibernate SessionFactory and how to configure it?

1 Answers  


How mapping of java objects is done with database tables?

1 Answers  


Categories