Transactions

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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.