FactoryBean that retrieves the JTA UserTransaction/TransactionManager for
ObjectWeb's JOTM. Will retrieve
an already active JOTM instance if found (e.g. if running in JOnAS),
else create a new local JOTM instance.
With JOTM, the same object implements both the
javax.transaction.UserTransaction and the
javax.transaction.TransactionManager interface,
as returned by this FactoryBean.
A local JOTM instance is well-suited for working in conjunction with
ObjectWeb's XAPool, e.g. with bean
definitions like the following:
<bean id="jotm" class="org.springframework.transaction.jta.JotmFactoryBean"/>
<bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
<property name="userTransaction" ref="jotm"/>
</bean>
<bean id="innerDataSource" class="org.enhydra.jdbc.standard.StandardXADataSource" destroy-method="shutdown">
<property name="transactionManager" ref="jotm"/>
<property name="driverName" value="..."/>
<property name="url" value="..."/>
<property name="user" value="..."/>
<property name="password" value="..."/>
</bean>
<bean id="dataSource" class="org.enhydra.jdbc.pool.StandardXAPoolDataSource" destroy-method="shutdown">
<property name="dataSource" ref="innerDataSource"/>
<property name="user" value="..."/>
<property name="password" value="..."/>
<property name="maxSize" value="..."/>
</bean>
Note that Spring's
JtaTransactionManager will automatically detect
that the passed-in UserTransaction reference also implements the
TransactionManager interface. Hence, it is not necessary to specify a
separate reference for JtaTransactionManager's "transactionManager" property.
Implementation note: This FactoryBean uses JOTM's static access method
to obtain the JOTM
org.objectweb.jotm.Current object, which
implements both the UserTransaction and the TransactionManager interface,
as mentioned above.
author: Juergen Hoeller since: 21.01.2004 See Also: JtaTransactionManager.setUserTransaction See Also: JtaTransactionManager.setTransactionManager See Also: org.objectweb.jotm.Current |