12C H A P T E R 1 2

Transactions

By enclosing one or more steps in an indivisible unit of work, a transaction ensures data integrity and consistency. This chapter contains the following sections:

“About Transactions” on page 143

“Admin Console Tasks for Transactions” on page 145

About Transactions

“What is a Transaction?” on page 143

“Transactions in Java EE Technology” on page 144

“Workarounds for Specific Databases” on page 145

What is a Transaction?

A transaction is a series of discreet actions in an application that must all complete successfully or else all the changes in each action are backed out. For example, to transfer funds from a checking account to a savings account is a transaction with the following steps:

1.Check to see if the checking account has enough money to cover the transfer.

2.If there’s enough money in the checking account debit the amount from the checking account.

3.Credit the money to the savings account.

4.Record the transfer to the checking account log.

5.Record the transfer to the savings account log.

If any of these steps fails, all changes from the preceding steps must be backed out, and the checking account and savings account must be in the same state as they were before the transaction started. This event is called a rollback. If all the steps complete successfully, the transaction is in a committed state. Transactions end in either a commit or a rollback.

143

Page 143
Image 143
Sun Microsystems 820433510 manual About Transactions, What is a Transaction?