问题是遇到数据库抛出的异常回滚成功,抛出java.lang.ArrayIndexOutOfBoundsException不回滚!!
编程式事务管理,配置如下:
<bean id="baseTxService"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
abstract="true">
<property name="transactionManager" ref="transactionManager" />
<property name="proxyTargetClass" value="true" />
<property name="transactionAttributes">
<props>
<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="load*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="*Regist*">PROPAGATION_REQUIRED</prop>
<prop key="update*">PROPAGATION_REQUIRED</prop>
<prop key="remove*">PROPAGATION_REQUIRED</prop>
</props>
</property>
<property name="preInterceptors">
<list>
<ref bean="methodCachePointCut" />
<ref bean="methodCachePointCutAdvice" />
</list>
</property>
</bean> <bean id="accountManager" parent="baseTxService">
<property name="target" ref="passPortBOImpl">
</property>
</bean>
。。
编程式事务管理,配置如下:
<bean id="baseTxService"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
abstract="true">
<property name="transactionManager" ref="transactionManager" />
<property name="proxyTargetClass" value="true" />
<property name="transactionAttributes">
<props>
<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="load*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="*Regist*">PROPAGATION_REQUIRED</prop>
<prop key="update*">PROPAGATION_REQUIRED</prop>
<prop key="remove*">PROPAGATION_REQUIRED</prop>
</props>
</property>
<property name="preInterceptors">
<list>
<ref bean="methodCachePointCut" />
<ref bean="methodCachePointCutAdvice" />
</list>
</property>
</bean> <bean id="accountManager" parent="baseTxService">
<property name="target" ref="passPortBOImpl">
</property>
</bean>
。。
解决方案 »
- 这样条件下的HttpServlet是线程安全的吗?
- struts2中DefaultTextProvider有什么用?
- 急 向高手请教请问如何将UTF-8转为GBK的编码
- Jbpm出错啦。找了很久都没有看到答案,高手帮帮我啊
- EJBEXCEPTION的问题.请教.......在线等
- 这是什么意思!
- 安装了JBuildX10,为什么不能注册?
- 初学求救!!!!!!!
- This J2EE SDK release runs only on java 2 (JDK1.2 or later)错误如何解决。
- jdbc mysql报错问题
- 权限系统中老板应该是怎么样一个角色
- web项目里,后台类怎么动态获得前台图片名称
配置上没看出问题
<prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="load*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="*Regist*">PROPAGATION_REQUIRED</prop>
<prop key="update*">PROPAGATION_REQUIRED</prop>
<prop key="remove*">PROPAGATION_REQUIRED</prop>这些开头了么
<bean id="transactionInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager" ref="transactionManager" />
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED,-Exception</prop>
</props>
</property>
</bean>
添加下看看
我用的是IBATIS,这样配也不能回滚,hibernate好像是可以回滚
我加上了下面这些,可以捕获到所有Exception了。
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="*" propagation="REQUIRED" rollback-for="Exception" />
</tx:attributes>
</tx:advice>
也是加上rollback-for才回滚的。例子上并没有这么写不明白bdgood luck