user manual
Chapter 19: Transaction management 203
Declarative transaction management in Enterprise JavaBeans
Example 2PC usage
1 (A) The client calls OrderSesEJB.create() method to create a new order.
2 (B) Since the bean is configured to use the OTS engine named
TwoPhaseEngine, the container locates the right transaction service
named TwoPhaseEngine, and uses it for beginning the transaction.
3 (C) The session bean does some database work, and sends a message to
a JMS queue.
4 (D) When the call is over, the Partition issues commit.
5 (E) The OTS engine coordinates the transaction completion with the
database and the JMS resources.
Example 2PC usage with MDBs
At some point in time, an asynchronous message is delivered to
OrderCompletionMDB by invoking its onMessage() method, which has a REQUIRED
transaction attribute. The container starts a transaction using ITS and then
invokes the onMessage() method. In the body of the method, the bean updates
the database to indicate order delivery. It is important to note that there are 2
resources involved. The first one is the JMS resource, which is associated
with the MDB instances that got the message, and the second is the database
that the MDB instance updated. This scenario is similar to the example
diagram above.
Note ejb.transactionManagerInstanceName is also supported for MDBs. See
Chapter 20, “Message-Driven Beans and JMS” for more information.
Declarative transaction management in Enterprise JavaBeans
Transaction management for Enterprise JavaBeans (EJBs) is handled by the
EJB Container and the EJBs. Enterprise JavaBeans make it possible for
applications to update data in multiple databases within a single transaction.










