websphere的transaction如何跟SPRING的配置结合

icey icey 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
以前一直用weblogic,现在要把程序的目标AP变成WEBSPHERE,
我在SPRING配置中的transaction配置如下
<bean id="wsJM" class="org.springframework.transaction.jta.WebSphereTransactionManagerFactoryBean"/>


<!-- Transaction Managers -->
<bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager"
scope="singleton">
<property name="transactionManager" ref="wsJM"/>
</bean>
<!-- Transaction Configuration -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="create*" propagation="REQUIRED" isolation="READ_COMMITTED" timeout="300" rollback-for="Throwable"/>
<tx:method name="update*" propagation="REQUIRED" isolation="READ_COMMITTED" timeout="300" rollback-for="Throwable"/>
<tx:method name="delete*" propagation="REQUIRED" isolation="READ_COMMITTED" timeout="300" rollback-for="Throwable"/>
<tx:method name="run*" propagation="REQUIRED" isolation="READ_COMMITTED" timeout="300" rollback-for="Throwable"/>
<tx:method name="find*" propagation="SUPPORTS" isolation="READ_COMMITTED" read-only="true" timeout="300" rollback-for="Throwable"/>
<tx:method name="is*" propagation="SUPPORTS" isolation="READ_COMMITTED" read-only="true" timeout="300" rollback-for="Throwable"/>
<tx:method name="count*" propagation="SUPPORTS" isolation="READ_COMMITTED" read-only="true" timeout="300" rollback-for="Throwable"/>
</tx:attributes>
</tx:advice>

<!-- Auto proxying -->
<bean id="ServiceAutoProxyBeanCreator"
class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
<property name="beanNames">
<list>
<value>*Service</value>
</list>
</property>
<property name="interceptorNames">
<list>
<value>txAdvice</value>
</list>
</property>
</bean>

这种配置,我在使用时候,执行create一些方法时候,系统会报错,说JtaTransactionManager does not support custom isolation levels by default - switch 'allowCustomIsolationLevels' to 'true'

我按他建议的,把'allowCustomIsolationLevels' 设置成true, 运行时可以, 但是我试验过transaction
一个方法里面,插入数据后,我故意抛出异常, 数据并没有被回滚

请问这个问题怎么解决?
...全文
评论 1
收藏 已收藏
分享
返回顶部
icey
WebSphere 2,632 成员 9,557 内容