确认
当前程序版本
mp 3.0.7 mybatis3.5.6 mybatis-spring 1.3.1
问题描述
`@Transactional(noRollbackFor = CustomBusinessException.class)
@Override
public void updateAndListByIds(List
try {
// 模拟 listByIds 操作,ids 为空时抛出异常
List<Student> users = (List) studentService.listByIds(ids);
System.out.println("查询结果: " + users);
} catch (Exception e) {
System.out.println("捕获异常: " + e.getMessage());
}
System.out.println("updateAndListByIds 执行完成");
}`
代码如上, 当我的ids为空List时, listByIds会因为where in ( ) 语法错误而抛出异常, 我catch了这个异常并且没有重新抛出, 理论上不应该导致前面的update发生回滚, 但是结果表明发生了回滚;
而且同步单步调试跟踪, 惊讶的发现, 实际上是触发了commitTransactionAfterReturning的操作, 发生了commit, 但是数据库并没有发生update;
是否有跟踪当前事务尚未提交语句的方法, 我想弄清楚在提交发生前, 我的update的操作是否已经受到listByIds异常的影响被抹除了, 或者有没有其他的排查方法?
详细堆栈日志
Comment From: miemieYaho
自行排查
Comment From: leaveM
自行排查
有排查路线嘛?