Transaction atomicity

AtomicityConcept http://en.wikipedia.org/wiki/Atomicity_(database_systems)

The idea is to debit money from the account. This leads to reduction in balance value on the account and creation of new transaction. It is implemented using jdbc directly.

no_Atomicity

The insert into Transactions table fails because the constraint in database doesn't allow amount greater than 999.99 resulting in SQLException.

The account's balance is reduced but no new transaction is created for it.

atomic

Begin a transaction.

The insert into Transactions table fails because the constraint in database doesn't allow amount greater than 999.99 resulting in SQLException.

Rollback transaction.

The account's balance is not reduced and no new transaction is created for it.