标签:system 指定 support rollback app mvc status todo generated
事物作用的impl类这样写的
@Override public int updateReturnAll(int item, int status, int idUser) { // TODO Auto-generated method stub try { int updateReturnAll = itemMapper.update****(); if(updateReturnAll>0){ Map<String, Object> map=new HashMap<String,Object>(); map.put("idpatient", item); map.put("ChargeDealWith", 0); Object callUpdatePPFIReturn = itemMapper.callUpdate****(map); System.out.println(callUpdatePPFIReturn+"=================="); System.out.println(map.get("RetMeg")+"----------"); if(!map.get("RetMeg").equals("")){ throw new Exception("callUpdatePPFIReturn异常!"); } return updateReturnAll; }else{ return 0; } } catch (Exception e) { TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); logger.error("updateReturnAll异常!",e); return 0; } }
如果没有
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();指定异常回滚,update是会提交的
springmvc+mybaits一个事物同时update和调用存储过程异常回滚
标签:system 指定 support rollback app mvc status todo generated
原文地址:https://www.cnblogs.com/yanan7890/p/8871935.html