Example of global transaction scope
Using active or passive transactions
i BATIS can participate in a global transaction in one of two ways: actively or pas-
sively. When configured to actively participate, i BATIS will look for the global
transaction context and attempt to manage it appropriately. This means that i BA-
TIS can check the state of an existing transaction or start one if necessary. It will
also be able to set the state to “rollback-only” in the event of an error, which will
notify other participating resources that the transaction should not be committed.
When configured to passively participate in a global transaction, i BATIS will
simply ignore all instructions to start, commit, and end transactions. It will throw
exceptions in the case of an error, which i BATIS assumes will cause the transaction
to be rolled back.
Deciding which to use is sometimes a matter of just trying it. Different applica-
tion servers and different architectures will work better one way or the other. The
good thing is, it's very easy to switch back and forth. Listing 7.4 shows the configu-
ration for both active participation and passive participation.
Global transaction manager configuration options
Search WWH ::