In this chapter we will cover the following topics:
ACID properties of a transaction
Container-managed transactions
Container-managed transaction demarcation
Session synchronization interface
Doomed transactions
Transaction isolation levels
Lost update problem
Optimistic and pessimistic locking
How EJB 3 implements optimistic locking
Bean-managed transactions and the user transaction interface
Up to now our examples have, for the most part, used transactions by default. Most of our examples have used container-managed transactions. As the name suggests, the transaction lifecycle is controlled by the EJB container. Container-managed transactions use the Java Transaction API, or JTA. Container-managed transactions have a default start and end point, however it is possible to configure these as we shall see later in this chapter. Java SE applications, which run outside an EJB container and so do not have JTA available, must use resource-local transactions. Resource...