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.
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
In the old days before Hibernate, we had to use the JDBC API to create drivers, connections, statements, and other objects to read and write from the database. Hibernate does all this work for us and more, and it still allows us to access the low-level JDBC features. For example, the implementation of transaction savepoints...