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:
Any help or pointers to resources that might be helpful would be really appreciated.Code:<bean id="jotm" class="org.springframework.transaction.jta.JotmFactoryBean"/> <bean id="jtaTransactionManager" class="org.springframework.transaction.jta.JtaTransactionManager"> <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.TransactionProxyFactoryBean" 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>
thanks...


Reply With Quote