calvin
Aug 25th, 2004, 08:53 PM
I would like to use the declarative transaction management abililities of TransactionProxyFactoryBean in conjunction with JTATransactionManager and JOTM.
My problem is that I can't wire-up the target on TransactionProxyFactoryBean, because the object that is to be proxied is supplied by Hibernate (recreated from database), and so isn't defined in my applicationContext.xml configuration file. As I understand it, the tx proxy factory bean only proxies the object that it is wired to in the configuration file.
I tried manually getting the factory bean and setting the target programmatically, but there was a startup error saying that target was not set.
This is what I have in my applicationContext.xml file so far:
<bean id="jotm" class="org.springframework.transaction.jta.JotmFactoryBea n"/>
<bean id="jtaTransactionManager" class="org.springframework.transaction.jta.JtaTransaction Manager">
<property name="userTransaction">
<ref local="jotm"/>
</property>
</bean>
<bean id="xaDataSource" class="org.enhydra.jdbc.standard.StandardXADataSource"
singleton="false" destroy-method="shutdown">
<property name="transactionManager">
<ref local="jotm"/>
</property>
</bean>
<bean id="xaPoolDataSource"
class="org.enhydra.jdbc.pool.StandardXAPoolDataSource"
destroy-method="shutdown" singleton="false">
<property name="dataSource">
<ref local="xaDataSource"/>
</property>
</bean>
<bean id="jtaTransactionProxy"
class="org.springframework.transaction.interceptor.Transa ctionProxyFactoryBean" lazy-init="true">
<property name="transactionManager">
<ref local="jtaTransactionManager"/>
</property>
<property name="transactionAttributes">
<props>
<!-- write actions: rollback if any exception occurs -->
<prop key="execute*">PROPAGATION_REQUIRED,-Exception</prop>
</props>
</property>
<property name="target">
<bean id="quartzJob" class="com.thatone.archie.engine.job.QuartzJobImpl" singleton="false"/>
</property>
</bean>
Any help or pointers to resources that might be helpful would be really appreciated.
thanks...
My problem is that I can't wire-up the target on TransactionProxyFactoryBean, because the object that is to be proxied is supplied by Hibernate (recreated from database), and so isn't defined in my applicationContext.xml configuration file. As I understand it, the tx proxy factory bean only proxies the object that it is wired to in the configuration file.
I tried manually getting the factory bean and setting the target programmatically, but there was a startup error saying that target was not set.
This is what I have in my applicationContext.xml file so far:
<bean id="jotm" class="org.springframework.transaction.jta.JotmFactoryBea n"/>
<bean id="jtaTransactionManager" class="org.springframework.transaction.jta.JtaTransaction Manager">
<property name="userTransaction">
<ref local="jotm"/>
</property>
</bean>
<bean id="xaDataSource" class="org.enhydra.jdbc.standard.StandardXADataSource"
singleton="false" destroy-method="shutdown">
<property name="transactionManager">
<ref local="jotm"/>
</property>
</bean>
<bean id="xaPoolDataSource"
class="org.enhydra.jdbc.pool.StandardXAPoolDataSource"
destroy-method="shutdown" singleton="false">
<property name="dataSource">
<ref local="xaDataSource"/>
</property>
</bean>
<bean id="jtaTransactionProxy"
class="org.springframework.transaction.interceptor.Transa ctionProxyFactoryBean" lazy-init="true">
<property name="transactionManager">
<ref local="jtaTransactionManager"/>
</property>
<property name="transactionAttributes">
<props>
<!-- write actions: rollback if any exception occurs -->
<prop key="execute*">PROPAGATION_REQUIRED,-Exception</prop>
</props>
</property>
<property name="target">
<bean id="quartzJob" class="com.thatone.archie.engine.job.QuartzJobImpl" singleton="false"/>
</property>
</bean>
Any help or pointers to resources that might be helpful would be really appreciated.
thanks...