Open transaction in Struts action
Anyone known how to open a transaction in Struts's action?
I've used the following config files:
-- applicationContext.xml:
lt;beansgt; lt;bean id=quot;dataSourcequot; class=quot;org..jndi.JndiObjectFactoryB eanquot;gt; lt;property name=quot;jndiNamequot;gt;lt;valuegt;java:comp/env/jdbc/repartoweblt;/valuegt; lt;/propertygt; lt;/beangt; lt;!-- Transaction manager for iBATIS DAOs --gt; lt;bean id=quot;transactionManagerquot; class=quot;org..jdbc.datasource.DataSou rceTransactionManagerquot;gt; lt;property name=quot;dataSourcequot;gt;lt;ref bean=quot;dataSourcequot;/gt;lt;/propertygt; lt;/beangt; lt;bean id=quot;dataSourceIbatisquot; class=quot;org..jdbc.datasource.Transac tionAwareDataSourceProxyquot;gt; lt;property name=quot;targetDataSourcequot;gt;lt;ref local=quot;dataSourcequot;/gt;lt;/propertygt; lt;/beangt; lt;!-- SqlMap setup for iBATIS Database Layer --gt; lt;bean id=quot;sqlMapClientquot; class=quot;org..orm.ibatis.SqlMapClient FactoryBeanquot;gt; lt;property name=quot;dataSourcequot;gt;lt;ref bean=quot;dataSourceIbatisquot;/gt;lt;/propertygt; lt;property name=quot;configLocationquot;gt;lt;valuegt;classpath:/ibatis/config/SqlMapConfig.xmllt;/valuegt; lt;/propertygt; lt;/beangt; lt;bean id=quot;patientDAOquot; class=quot;it.axiosinformatica.webward.database.implem entations.PatientSqlMapDaoquot;gt; lt;!--property name=quot;dataSourcequot;gt;lt;ref bean=quot;dataSourceIbatisquot;/gt;lt;/property--gt; lt;property name=quot;sqlMapClientquot;gt;lt;ref bean=quot;sqlMapClientquot;/gt;lt;/propertygt; lt;/beangt;
lt;!-- Transaction template for Managers, from: colin/archives/...ons-spring-11/ --gt; lt;bean id=quot;txProxyTemplatequot; abstract=quot;truequot; class=quot;org..transaction.interceptor .TransactionProxyFactoryBeanquot;gt; lt;property name=quot;transactionManagerquot;gt;lt;ref bean=quot;transactionManagerquot;/gt;lt;/propertygt; lt;property name=quot;transactionAttributesquot;gt;lt;propsgt; lt;prop key=quot;*quot;gt ROPAGATION_REQUIRED, -DataAccessException, -UncategorizedSQLException, -SQLException, -NullPointerExceptionlt;/propgt;lt;/propsgt; lt;/propertygt; lt;/beangt;
lt;bean id=quot;patientManagerquot; parent=quot;txProxyTemplatequot;gt; lt;property name=quot;targetquot;gt;lt;bean class=quot;it.axiosinformatica.webward.manager.impl.Pa tientManagerImplquot;gt; lt;property name=quot;patientDAOquot;gt;lt;ref bean=quot;patientDAOquot;/gt;lt;/propertygt; lt;property name=quot;patientDietManagerquot;gt;lt;ref bean=quot;patientDietManagerquot;/gt;lt;/propertygt; lt;property name=quot;fastManagerquot;gt;lt;ref bean=quot;fastManagerquot;/gt;lt;/propertygt;lt;/beangt; lt;/propertygt; lt;/beangt;
lt;/beansgt;--next, i've created action-servlet.xml
lt;beansgt;
lt;bean name=quot;/manageAdmissionsNewPatientSubmitquot; class=quot;it.axiosinformatica.webward.web.actions.man ageAdmissions.ManageAdmissionsNewPatientActionquot; singleton=quot;truequot; gt; lt;property name=quot;patientManagerquot;gt;lt;ref bean=quot;patientManagerquot;/gt;lt;/propertygt; lt;property name=quot;mealManagerquot;gt;lt;ref bean=quot;mealManagerquot;/gt;lt;/propertygt; lt;property name=quot;fastManagerquot;gt;lt;ref bean=quot;fastManagerquot;/gt;lt;/propertygt; lt;property name=quot;patientDietManagerquot;gt;lt;ref bean=quot;patientDietManagerquot;/gt;lt;/propertygt; lt;/beangt;
lt;/beansgt;
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 quot;open session in view Interceptorquot;
Help! |