提示
被调用的方法老是会跟随调用方回滚就算设置各种@transactional失效方式也没有用
@Transactional失效方式可以看我之前的文章
java
@Transactional(propagation = Propagation.REQUIRES_NEW,noRollbackFor = Exception.class)
public void saveRecCallInterfaceLog(RecCallInterfaceLogEntity recCallInterfaceLogEntity) {
int reslut= recCallInterfaceLogMapper.insert(recCallInterfaceLogEntity);
if (reslut>0){
logger.info("接口调用表更新成功");
}else{
logger.info("接口调用表更新失败");
}
}
Propagation.REQUIRES_NEW 是开启新的事务,不和调用方合并成一个,防止被一起回滚。
noRollbackFor = Exception.class 是设置该方法任何异常都不回滚
本文作者:Weee
本文链接:
版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
预览: