What is transaction management in hibernate

Q. What is transaction management in hibernate? How we get transaction object in hibernate?

Let’s see what is transaction –

  1. Transaction is an interface available in org.hibernate package which is associated with the session.
  2. In the transaction, if any single step fails, the complete transaction will be failed.
  3. We can describe transaction with ACID properties.

A. Atomicity – All success or none.
B. Consistency – Database constraints should not be violated.
C. Isolation – One transaction should not effect another one.
D. Durability – It should in Database after commit.

4. We can get Transaction object with help of session.

5. Transaction object further can be used to call commit() or rollback() method.

Let’s see complete example to get Transaction object – 


In real time development, let’s see how transaction Management works(using Spring).