Different Object States in Hibernate?
An object created using new Operator is known in Transient State. This object is not associated with database.
When a Transient object with values are stored in database, then the object is said to be in Persistent State.
When an object is saved in the database and the hibernate session is closed, The object is said to be in Detached State
What is a Transaction?
Transaction is a sequence of operations performed.
Properties of Transactions?
Every transaction should have the following ACID properties,
Atomic : All the modifications to be performed or none to be performed
Consistency: All data should be consistent once the transaction has been completed
Isolation: Every transaction should be Isolated from another transaction
Durability: Data change in a system after the transaction is completed should remain permanent in the System.
States of Transactions:
when transaction is created and ready for execution.
When all the operations are performed but the transaction is not yet committed.
When transaction is failed and cannot proceed further.
Transaction is failed and the operations of transactions are rolled back.
Transaction is success and all the changes are committed and saved in database.
When transaction is completed successfully or when transaction is failed this state occurs.
Methods to Configure Transactions:
Starts the transaction.
Ends the work.
Reverse the changes.
checks whether the transaction is committed or not.
checks if transaction is rolledback or not.