Java Reference
In-Depth Information
Listing 6-28. transaction-config.xml
<bean id="jpaTransactionManager"
<property name="entityManagerFactory"
ref="entityManagerFactory" />
Note that this transaction manager needs an entity manager factory, that is, an
implementation of the javax . persistence . EntityManagerFactory . This factory provides the
EntityManager . The JpaTransactionManager uses this EntityManager to coordinate transac-
JTA Transactions
The transaction managers described earlier are not very suitable for distributed XA
transactions. XA describes a protocol to coordinate transactions involving multiple trans-
action and resource managers. BEA WebLogic Server and JBoss Application Server (AS)
are examples of transaction managers. They manage transactions involving multiple
resource managers such as databases, messaging providers such as IBM MQ Series,
mainframes, and so on.
In such scenarios you will need to use the JTATransactionManager . It generally dele-
gates the transaction handling responsibility to the underlying JTA implementation
provided by BEA WebLogic Server, JBoss AS, ObjectWeb JOTM, or Atomikos. Listing 6-29
shows the configuration of JTATransactionManager .
Listing 6-29. transaction-config.xml
<bean id="transactionManager" class="org.springframework. å
<property name="transactionManagerName"
value="java:/TransactionManager" />
JtaTransactionManager works with the javax.transaction.UserTransaction and
javax.transaction.TransactionManager objects, delegating responsibility for transaction
management to those objects. A successful transaction will be committed with a call to
Search WWH ::

Custom Search