What is difference between get and load?



What is difference between get and load?..

Answer / Naina Gupta

In Hibernate, 'get' method retrieves an entity from the first level cache (Session cache) if it exists. If the entity is not found in the cache, a query is executed to fetch the entity from the database. On the other hand, 'load' method fetches the data lazily from the database and returns a proxy object, which is populated only when an accessor method is called or the identifier of the entity is requested.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Hibernate Interview Questions

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

1 Answers  


What is @id in hibernate?

1 Answers  


How do I save in hibernate?

1 Answers  


What is the benefit of hibernate criteria api?

1 Answers  


How hibernate sessions work?

1 Answers  


What is session evict in hibernate?

1 Answers  


What are the Collection types in Hibernate?

1 Answers  


Define the collection types in hibernate?

1 Answers  


What is hibernate criteria?

1 Answers  


How will you integrate hibernate with spring framework?

1 Answers  


What is the role of session interface in hibernate?

1 Answers  


What is @embeddedid in hibernate?

1 Answers  


Categories