T R A N S A C T I O N S
Transactions can become trickier when you need to use third party applications if internal or
external. Now a transaction must include this third party application by handing over the
transactions to the other party meaning we need a distributed transaction. This sounds not
much more complicated but considering the fact that the connection to the third party
application is lost or it does not respond in time we maybe have to determine the outcome
heuristic to go on with our application. Heuristic because the application does not know
where the failure was, the client could not have received the request, the request could have
been processed successful or could have failed or when the third party application responded
but the connection dropped beforehand.
Transactions are associated with threads. When a thread calls a component, the transaction
is automatically propagated with the thread of execution. This happens for local as well as
remote calls.
In J2EE nested transactions are not allowed. Therefore we cannot have a transaction inside
another transaction. But using the javax.transaction.TransactionManager interface it is
possible to suspend a transaction and then use no transaction or another transaction. This
allows the application server to perform actions outside the given transaction in its own
transaction or completely without one. After these steps are done the transaction is
reactivated and the next steps can be performed. Please note that the TransactionManager
interface is not meant to be used by components hosted by the J2EE server. Components
should always use the javax.transaction.UserTransaction interface instead.
In J2EE the bean developer has two choices how to use transactions. Either he can let the
container managed the transactions or he can managed transactions in the bean.
Container Managed Transaction (CMT)
In a CMT bean the container manage the transactions. How to do so is specified by the
transaction attributes in the bean deployment descriptor ( trans attribute ). The following
graphics uses a black arrow for a call without a transaction, a blue arrow for a transaction
coming from the caller, a red arrow for a new transaction created in the transaction
interceptor that is indicated by the dark gray box. There are six different transaction
attributes:
53
footer
Our partners:
PHP: Hypertext Preprocessor Cheap Web Hosting
JSP Web Hosting
Ontario Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Java Hosting
Cheapest Hosting
Visionwebhosting.net Business web hosting division of Vision Web Hosting Inc.. All rights reserved