Hibernate - Explain the types of Hibernate instance states.

Explain the types of Hibernate instance states.

- The persistent class’s instance can be in any one of the three different states.

- These states are defined with a persistence context. The Hibernate has the following instance states:

1. Transient : This instance is never been associated with any one of the persistence process. This does not have persistent identity like primary key value.

2. Persistent : A persistent context is made to associate with the current instance. It has persistent identity like primary key value and a corresponding row of a table in the data base. Hibernate guarantees the persistent identity is equivalent to the java Identity [object], for a particular persistence context

3. Detatched : This instance association with a persistence context is only once and the context was closed or serialized to another process. The persistent identity is retained and it can be a corresponding row in a database.

Explain the types of Hibernate instance states.

- Three types of instance states:

1. Transient :In this state, an instance is not associated with any persistence context.

2. Persistent :In this state, an instance is associated with a persistence context.

3. Detached :This is a state for an instance which was previously associated with a persistence context an has been currently closed dissociated.
Hibernate - What are Collection types in Hibernate?
What are Collection types in Hibernate? - A collection is defined as a one-to-many reference...
Hibernate - What is lazy initialization in hibernate?
What is lazy initialization in hibernate? - The delaying the object creation or calculating a value or some process until the first time it is needed...
Hibernate - What is lazy fetching in hibernate?
What is lazy fetching in hibernate? - Lazy fetching is associated with child objects loading for its parents..
Post your comment
Discussion Board
Thread safe = synchronized methods = concurrent threads cannot access the object
SessionFactory is thread safe which means that it can be run in multi threaded environment which implies that multiple threads cannot access the object concurrently unless thread has been put into wait
subrahmanya 10-21-2014