Hibernate has three object states that has been stated below.
Transient:
* If Object is transient, instance has just been instantiated with new Operator and it's not associated with Hibernate Sesssion. It has no persistance representation in database and no identifier value has been assigned.
* Transient object will be garbage collected if application doesnt have any reference any more. Use the Hibernate session to make an Object persistent.
Persistance:
* A persistance instance has a representation in database and an identifier value. It might have been just saved or loaded. It will be associated with a hibenate session.
* Hibernate will detect any changes made to an object in persistent state and synchronize the state with the database when the unit of work completes.
Detached:
* A detached instance is persistence but its session is closed. It will be modified in the current state if the reference of the object is valid.
* A detached instance can be reattached to a new session and maing it persistent again.
Transient:
* If Object is transient, instance has just been instantiated with new Operator and it's not associated with Hibernate Sesssion. It has no persistance representation in database and no identifier value has been assigned.
* Transient object will be garbage collected if application doesnt have any reference any more. Use the Hibernate session to make an Object persistent.
Persistance:
* A persistance instance has a representation in database and an identifier value. It might have been just saved or loaded. It will be associated with a hibenate session.
* Hibernate will detect any changes made to an object in persistent state and synchronize the state with the database when the unit of work completes.
Detached:
* A detached instance is persistence but its session is closed. It will be modified in the current state if the reference of the object is valid.
* A detached instance can be reattached to a new session and maing it persistent again.