Hello,
I'm trying to port over to use JtaTransactionManager as we introduce multiple databases. Using a single DB and DatasourceTransactionManager works great. I was hoping to drop in JtaTransactionManager, but no luck. Even when a RuntimeException is thrown, the txn is not rolled back.
I'm hoping someone can see a problem in my configuration?
Thanks!
My testing Service is merely:Code:<bean id="jotm" class="org.springframework.transaction.jta.JotmFactoryBean"/> <bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager"> <property name="userTransaction"><ref local="jotm"/></property> </bean> <bean id="oracleDataSource" class="org.enhydra.jdbc.standard.StandardXADataSource" destroy-method="shutdown"> <property name="transactionManager"><ref local="jotm"/></property> <property name="driverName"><value>oracle.jdbc.OracleDriver</value></property> <property name="url"><value>jdbc:oracle:thin:@alewa.ehawaii.gov:1528:hict</value></property> <property name="user"><value>seth</value></property> <property name="password"><value>seth</value></property> </bean> <bean id="oracleDao" class="test.jdbc.TestDaoImpl"> <property name="dataSource"><ref local="oracleDataSource" /></property> </bean> <bean id="service" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"><ref bean="transactionManager"/></property> <property name="target"> <bean class="test.jdbc.ServiceImpl"> <property name="mysqlDao"><ref local="mysqlDao" /></property> <property name="oracleDao"><ref local="oracleDao" /></property> </bean> </property> <property name="transactionAttributes"> <props> <prop key="*">PROPAGATION_REQUIRED</prop> </props> </property> </bean>
When I replace my TransactionProxyFactoryBean's transacationManager w/ the DataSourceTransactionManager, it works great (I've also replaced the XADataSource with a StandardDataSource). I drop in JOTM and JTA and it starts to fail.Code:public void performActionThatWillFail() { oracleDao.insert("foo"); throw new RuntimeException("MAKE THIS FAIL AND ROLLBACK"); }
Any tips or tricks?
Thanks very much!


Reply With Quote