Anyone known how to open a transaction in Struts's action?
I've used the following config files:
-- applicationContext.xml:
<beans>
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryB ean">
<property name="jndiName">
<value>java:comp/env/jdbc/repartoweb</value>
</property>
</bean>
<!-- Transaction manager for iBATIS DAOs -->
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSou rceTransactionManager">
<property name="dataSource"><ref bean="dataSource"/></property>
</bean>
<bean id="dataSourceIbatis" class="org.springframework.jdbc.datasource.Transac tionAwareDataSourceProxy">
<property name="targetDataSource"><ref local="dataSource"/></property>
</bean>
<!-- SqlMap setup for iBATIS Database Layer -->
<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClient FactoryBean">
<property name="dataSource"><ref bean="dataSourceIbatis"/></property>
<property name="configLocation">
<value>classpath:/ibatis/config/SqlMapConfig.xml</value>
</property>
</bean>
<bean id="patientDAO" class="it.axiosinformatica.webward.database.implem entations.PatientSqlMapDao">
<!--property name="dataSource"><ref bean="dataSourceIbatis"/></property-->
<property name="sqlMapClient"><ref bean="sqlMapClient"/></property>
</bean>
<!-- Transaction template for Managers, from:
http://blog.exis.com/colin/archives/...ons-spring-11/ -->
<bean id="txProxyTemplate" abstract="true"
class="org.springframework.transaction.interceptor .TransactionProxyFactoryBean">
<property name="transactionManager"><ref bean="transactionManager"/></property>
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED, -DataAccessException, -UncategorizedSQLException, -SQLException, -NullPointerException</prop>
</props>
</property>
</bean>
<bean id="patientManager" parent="txProxyTemplate">
<property name="target">
<bean class="it.axiosinformatica.webward.manager.impl.Pa tientManagerImpl">
<property name="patientDAO"><ref bean="patientDAO"/></property>
<property name="patientDietManager"><ref bean="patientDietManager"/></property>
<property name="fastManager"><ref bean="fastManager"/></property>
</bean>
</property>
</bean>
</beans>
--next, i've created action-servlet.xml
<beans>
<bean name="/manageAdmissionsNewPatientSubmit" class="it.axiosinformatica.webward.web.actions.man ageAdmissions.ManageAdmissionsNewPatientAction" singleton="true" >
<property name="patientManager"><ref bean="patientManager"/></property>
<property name="mealManager"><ref bean="mealManager"/></property>
<property name="fastManager"><ref bean="fastManager"/></property>
<property name="patientDietManager"><ref bean="patientDietManager"/></property>
</bean>
</beans>
The problem is this: thae manager that i load in action-servlet are all in different transaction.
Everyone known how to extends the transaction in the action?????
It is similar with Hibernate "open session in view Interceptor"
Help!


Reply With Quote