T R A N S A C T I O N S
Chapter
7
7. Transactions
A Unit of Work in Action
An EJB container must provide some service to the applications deployed on and the user
using the applications. The transaction service allows an application and / or the user of an
application to specify the unit of work that is defined by four different aspects called ACID
for short:
Atomic: A transaction is performed completely or not at all meaning that any changes
made during the transaction must be reversed if the transaction is not successfully
completed.
Consistency: The transaction must ensure that the system (data store) is in a
consistent state after the transaction has ended. Of course the system must have been
in a consistent state before the transaction was started otherwise this does not apply.
Note that the application developer must still make his/her part to ensure
consistency.
Isolation: The transaction must run isolated from any other processes or transactions
until transaction is finished. The two extremes are that either all other sees the
changes during a transaction or that only the process in the transaction sees the
changes and the other see the old data. As you maybe can imagine the isolation comes
with a performance hit. Therefore in J2EE are several types of isolations defined.
Durable: The changes in a transaction must be made persistent when a transaction
finishes.
Transactions are pretty important and most people take it for given but a good
implementation needs a good design from the beginning. Imagine that you want to order a
flight on line. The airline would not be very happy when you could reserve the seats but
never pay for the flight. On the other hand you want to get the selected seats after you paid
for the tickets. These requirements mean that the seats must be locked when they are
selected until the customer pays and if not the seats must be released.
52
footer
Our partners:
PHP: Hypertext Preprocessor Cheap Web Hosting
JSP Web Hosting
Ontario Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Java Hosting
Cheapest Hosting
Visionwebhosting.net Business web hosting division of Vision Web Hosting Inc.. All rights reserved