Hibernate 事务问题

东哥捱挮 东哥捱挮 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
先上代码
<!-- 配置事务的传播特性 -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="find*" read-only="true" propagation="NOT_SUPPORTED"/>
<tx:method name="get*" read-only="true" propagation="NOT_SUPPORTED"/>
<tx:method name="query*" read-only="true" propagation="NOT_SUPPORTED"/>
<tx:method name="load*" read-only="true" propagation="NOT_SUPPORTED"/>
<tx:method name="*" propagation="REQUIRED" />
</tx:attributes>
</tx:advice>

<!-- 配置哪些类哪些方法使用事务 -->
<aop:config proxy-target-class="true">
<aop:pointcut id="allManagerMethod"
expression="(execution(* com.teamsun.drp.service..*.*(..))) " />
<aop:advisor advice-ref="txAdvice"
pointcut-ref="allManagerMethod" />
</aop:config>

这一层次就是service层,上面是我配置的事务
public void a()throws Exception{
dao.update();
b();
}
public void b()throws centerException(){
....
throw new centerException("有错");
}


我纳闷的是,我抛了异常。怎么还提交事务呢,update都执行了。。咋解决
...全文

相关推荐

评论 9
收藏 已收藏
分享
返回顶部
东哥捱挮
Java EE 67,535 成员 225,843 内容