Chapter 11. Transactions and concurrency

 

In this chapter

  • Defining database and system transaction essentials
  • Controlling concurrent access with Hibernate and JPA
  • Using nontransactional data access

In this chapter, we finally talk about transactions: how you create and control concurrent units of work in an application. A unit of work is an atomic group of operations. Transactions allow you to set unit of work boundaries and help you isolate one unit of work from another. In a multiuser application, you may also be processing these units of work concurrently.

To handle concurrency, we first focus on units of work at the lowest level: database and system transactions. You’ll learn the APIs for transaction demarcation and how to define units of work in Java code. We’ll talk about how to preserve isolation and control concurrent access with pessimistic and optimistic strategies.

Finally, we look at some special cases and JPA features, based on accessing the database without explicit transactions. Let’s start with some background information.

11.1. Transaction essentials

 
 
 

11.1.1. ACID attributes

 
 

11.1.2. Database and system transactions

 
 

11.1.3. Programmatic transactions with JTA

 
 

11.1.4. Handling exceptions

 

11.1.5. Declarative transaction demarcation

 
 
 

11.2. Controlling concurrent access

 
 
 
 

11.2.1. Understanding database-level concurrency

 
 
 

11.2.2. Optimistic concurrency control

 

11.2.3. Explicit pessimistic locking

 
 

11.2.4. Avoiding deadlocks

 
 
 
 

11.3. Nontransactional data access

 

11.3.1. Reading data in auto-commit mode

 
 

11.3.2. Queueing modifications

 
 
 

11.4. Summary

 
 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest