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



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

Answer / Sameer Jha

In Hibernate, the load() method retrieves an object from the database by its primary key but does not initialize its lazy associations. The returned object may be a proxy object that needs to be initialized using the Hibernate Session's initialize() method. On the other hand, the get() method also loads the object with its lazy associations as soon as it is fetched.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Hibernate Interview Questions

Why we use hibernate?

1 Answers  


What does hibernate.properties file consist of?

1 Answers  


What is an api full form?

1 Answers  


What is lazy loading hibernate?

1 Answers  


Explain the mechanism by which you can distinguish between transient (i.e. Newly instantiated) and detached objects in hibernate?

1 Answers  


What are persistent objects hibernate?

1 Answers  


Why would you use an orm?

1 Answers  


How many attributes are there in column annotation?

1 Answers  


Why hibernate is used?

1 Answers  


What is the use of transient?

1 Answers  


What is the benefit of hibernate?

1 Answers  


How to get single column from database using hibernate?

1 Answers  


Categories