A transaction is the execution of a set of activities as one unit-of-work. This unit-of-work is a set of activities that relate to each other and must be completed together. If any of these activities fail, the entire unit-of-work must be undone.

A transaction example: banking transfer

We extend our banking transfer example in the context of transactions. Let’s say that we want to transfer money from one account to the other, as we do in the transfer method of the banking session bean. The activities that must be performed are:

  • Withdraw the money from one account.

  • Create a transaction record for that account.

  • Deposit the money to another account.

  • Create a transaction record for that account.

The transaction record is important because ...

Get EJB 2.0 Development with WebSphere Studio Application Developer now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.