We are using JOTM for Transaction Manager functionality when running our code outside of an app server. Our configuration looks like this:
In certain situations we need to increase the default transaction timeout, which with JOTM is 60 seconds (this is a batch application).Code:<beans> <bean id="jotm" class="org.springframework.transaction.jta.JotmFactoryBean"> </bean> <bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager"> <property name="userTransaction"><ref local="jotm"/></property> </bean> <bean id="dataSource" class="org.enhydra.jdbc.pool.StandardXAPoolDataSource" destroy-method="shutdown"> <property name="dataSource"> <bean class="org.enhydra.jdbc.standard.StandardXADataSource" destroy-method="shutdown"> <property name="transactionManager" ref="jotm" /> <property name="driverName" value="com.ibm.db2.jcc.DB2Driver" /> <property name="url" value="jdbc:db2:dbname" /> <property name="user" value="xxx"/> <property name="password" value="xxx"/> </bean> </property> <property name="user" value="xxx"/> <property name="password" value="xxx"/> <property name="maxSize" value="50"/> </bean> <bean id="exampleDAO" class="example.ExampleDAOImpl"> <property name="dataSource"><ref bean="dataSource"></ref></property> </bean>
How do you set a property on the JotmFactoryBean to set the transaction timeout value? The JotmFactoryBean bean itself does not have transactionTimeout property, but the bean it returns does (an instance of JOTM current).
In this case do I need to write a wrapper bean around the JotmFactoryBean to a) get an instance from the factory, and then b) set the transactionTimeout on it?
I know I can programmatically call setTransactionTimeout() on Current, which is returned by JotmFactoryBean, so writing a wrapper bean to do this seems like the way I have to do this, but is there an easier way?
Thanks,
Kevin Hooke


Reply With Quote
