O'Reilly logo

Mastering Hibernate by Ramin Rad

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Transaction management

You will certainly have worked with transactions. They ensure that a unit of work is atomic, consistent, isolated, and durable. Hibernate either uses JDBC to manage transactions or participates in a global transaction, JTA.

Local transactions

We discussed session scope in Chapter 1, Entity and Session. As we saw, one of the options for setting the session context was a local thread. This means that the scope of the session is within the thread that is executing the code, and Hibernate will start the Transaction using the API provided by JDBC. For further information on transaction management using JDBC, refer to the JavaDoc for java.sql.Connection.

In the old days before Hibernate, we had to use the JDBC API to create drivers, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required