Hello!, I have a problem with my Transaction. The problem is that Spring is generating one Transaction per Dao and I can't rollback the changes in an previous insert or update when an error ocurred.
My definition is:
Can I have the same Transaction for all the DAO operations??. I need to Rollback a previous DAO operation when the actual DAO operation crash a throws an Exception.HTML Code:<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans> <import resource="dataSourceFactoryBeans.xml"></import> <bean id="dataSource" class="javax.sql.DataSource" factory-bean="portalDataSourceFactory" factory-method="getDataSource"> </bean> <bean id="hibernateTransactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="dataSource"> <ref bean="dataSource"/> </property> <property name="sessionFactory"><ref local="portalSessionFactory"/></property> </bean> <bean id="abstractSessionFactory" abstract="true" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource" ref="dataSource"/> <property name="mappingResources"> <list> <value>com/tonline/albura/osiris/business/hibernate/Accion.hbm.xml</value> <value>com/tonline/albura/osiris/business/hibernate/CoberturaRed.hbm.xml</value> </list> </property> </bean> <bean id="portalSessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean" parent="abstractSessionFactory"> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.OracleDialect</prop> <prop key="hibernate.jdbc.batch_size">0</prop> <prop key="hibernate.jdbc.use_streams_for_binary">true</prop> <prop key="hibernate.connection.SetBigStringTryClob">false</prop> <prop key="hibernate.cache.use_query_cache">false</prop> <prop key="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</prop> <prop key="hibernate.show_sql">true</prop> </props> </property> </bean> <bean id="hibernateDao" abstract="true" class="com.ya.telco.dataAccessTools.HibernateDAO"> <property name="dataSource"> <ref bean="dataSource"></ref> </property> <property name="component"> <ref bean="component"></ref> </property> <property name="sessionFactory"><ref local="portalSessionFactory"/></property> </bean> <bean name="proxyHibernate" abstract="true" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"> <ref bean="hibernateTransactionManager"/> </property> <property name="transactionAttributes"> <props> <prop key="*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <bean name="coberturaRedHib" class="com.tonline.albura.osiris.business.hibernate.CoberturaRed" singleton="false"> <property name="coberturaRedDAOHib"> <ref bean="coberturaRedDAOHib"></ref> </property> </bean> <bean name="coberturaRedDAOHib" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean" parent="proxyHibernate" lazy-init="true"> <property name="target"> <bean class="com.tonline.albura.osiris.dao.hibernate.CoberturaRedDAOImpl" parent="hibernateDao"/> </property> </bean> <bean name="component" class="com.app.second.osiris.OsirisComponent"></bean> </beans>
Thanks
pd: I speak English a little (I´m Spanish)


)
Reply With Quote