Java伪代码:@Trans //spring事务管理控制
public void method() throws Exception{
   dao.update(xxxx);
   dao.insert(xxxx); //执行两个DAO层的操作
   int result = dao.callsp("mysp",{xxx}); //调用存储过程
   if (result==0)
     throw new exception("error");
}MYSQL存储过程伪代码:
set @result =0;
begin trans
  insert...
  update ...
commit
set @result=1;求大虾帮看看:
1. 存储过程返回值不为1抛出异常后,把DAO层中的两个操作也一道COMMIT了,不会回滚数据
2. 把callsp放在调用的方法外面,事务策略使用NEW,单独开启SP的新事务,也是一样的结果感谢!