What are the two locking strategies in Hibernate?

There are two popular locking strategies that can be used in Hibernate: Optimistic: In Optimistic locking we assume that multiple

What is the use of version number in Hibernate?

Version number is used in optimistic locking in Hibernate. When a transaction modifies an object, it increments its version. Based

What is the use of session.lock() method in Hibernate?

Session.lock() is a deprecated method in Hibernate. We should not use it. Instead we should call buildLockRequest(LockMode).lock(entityName, object) method in

What inheritance mapping strategies are supported by Hibernate?

Hibernate supports following inheritance mapping strategies between classes and tables: Table per class hierarchy: In case of multiple types of

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

In Hibernate, load() and get() methods are quite similar in functionality. The main difference is that load() method will throw

When should we use get() method or load() method in Hibernate?

As a thumb rule we can follow these guidelines:

What is a derived property in Hibernate?

In Hibernate, a derived property is not mapped to any column of a database table. A derived property is computed

How can we check is a collection is initialized or not under Lazy Initialization strategy?

Hibernate provides two convenient methods, Hibernate.initialize() and Hibernate.isInitialized() to check whether a collection is initialized or not. By using Hibernate.initialize()

What are the different strategies for cache mapping in Hibernate?

Hibernate provides following strategies for cache mapping: Read only: If an application requires caching only for read but not for