Java Reference
In-Depth Information
Global —A complex, broadly scoped transaction involving many statements
and many databases or potentially other transaction capable resources such
as JMS (Java Messaging Service) queues or JCA ( J2EE Connector Architec-
ture) connections.
Custom —i BATIS supports user-provided connections for which you can man-
age the transactions however you like.
We've dedicated a section of this chapter to each of these scopes. Before we dis-
cuss them in more detail, let's first talk about the properties of transactions.
Understanding transaction properties
Certain properties, or features, are required for a system to be able to honestly
claim it is capable of performing transaction processing. Nearly all modern rela-
tional databases support transactions, and any that don't should not be consid-
ered for enterprise solutions. The properties are known as the ACID (atomicity,
consistency, isolation, and durability) properties.
The feature that guarantees that all steps in a transaction either succeed or fail as
a group is called atomicity . Without this, it's possible that the database could be left
in an inaccurate state because one step of the transaction failed. This can be illus-
trated very simply by thinking of mathematical addition. Let's add up some num-
bers and consider each addition as a step in the transaction (table 7.5).
Table 7.5
Desired transaction
Transaction state
Initial State
Step 1
+ 30
Step 2
+ 45
Step 3
+ 15
End State
= 100
Search WWH ::

Custom Search