O'Reilly logo

Enterprise JavaBeans™ Component Architecture: Designing and Coding Enterprise Applications by Paul Anderson, Gail Anderson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

6.4. Transaction Overview

Business transactions are frequently carried out in a series of separate steps. Consider the following example where a customer purchases an airline ticket online. Here we use pseudocode that shows the required steps in a transactional environment.

try {
  startTransaction();
    reserveFlight();
    payForFlight();
  commitTransaction();
} catch (Exception ex) {
    rollbackTransaction();
}

For this transaction to complete, all steps must be successful. Otherwise, data may be inconsistent. These separate steps make up a transaction context, which is viewed as a single operation.

A transaction that commits means that all steps in the transaction were successful and data is saved. A transaction that rolls back means that one or more ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required