zhengqx123456
2011-09-17 15:40spring 事务回滚
@Transactional
public Map routSave(RoutFormBean routbean) throws Exception{
Map result=new HashMap();
StringBuffer sb=new StringBuffer();
sb.append("delete from WfNrouteTbl where nrountePk.dnp_kbn='");
sb.append(routbean.getDnp());
sb.append("' and nrountePk.dep='");
sb.append(routbean.getDiv());
sb.append("' and nrountePk.rtno=");
sb.append(routbean.getRtno());
commonService.updateByHql(sb.toString());
if (1==1){
throw new Exception("asdfa");
}
}
如上事务中、事务不会回滚
如果改成
throw new RuntimeException("asdfa");
则事务会回滚
为什么?
- 点赞
- 回答
- 收藏
- 复制链接分享
1条回答
为你推荐
- springboot多数据源事物回滚不生效
- java
- spring
- oracle
- mysql
- jar
- 3个回答
- spring3 注解式事务不起作用
- spring
- hibernate
- 0个回答
- Spring事务无法生效的问题。
- spring
- 0个回答
- Spring 事务管理,事物不回滚
- it技术
- 互联网问答
- IT行业问题
- 计算机技术
- 编程语言问答
- 0个回答
- Spring 事务回滚失败
- spring
- 0个回答
换一换