Book Image

EJB 3 Developer Guide

By : Michael Sikora
Book Image

EJB 3 Developer Guide

By: Michael Sikora

Overview of this book

Table of Contents (18 chapters)
EJB 3 Developer Guide
Credits
About the Author
About the Reviewers
Preface
Annotations and Their Corresponding Packages

Concurrency and Database Locking


In this section we cover concurrency and database locking topics. Isolation levels deal with concurrency issues that arise when two or more transactions simultaneously operate on the same data. We discuss isolation levels in the next subsection. The "Lost Update Problem" subsection describes a problem that can occur when transactions concurrently update the same data. The lost update problem is resolved by one of two strategies: pessimistic locking and optimistic locking. Optimistic locking is implemented in EJB 3 using version fields: we discuss this in the "Versioning" subsection.

Isolation Levels

We mentioned earlier that isolation was the third of the ACID properties of transactions. Isolation levels deal with concurrency issues that arise when two or more transactions are simultaneously operating on the same data. There are three problems that can occur with concurrent transactions: the dirty read, unrepeatable read, and phantom read problems. Each isolation...