@transactional注解,报错后数据库回滚失败

1. https://jingyan.baidu.com/article/3a2f7c2e27d51b26afd611ff.html

2. https://blog.csdn.net/lee_star1/article/details/71730107

需抛出RuntimeException错误

throw new RuntimeException("回滚");
try {
    //业务逻辑
} catch (Exception e) {
    task = false;
    e.printStackTrace();
    throw new RuntimeException("数据插入失败,回滚");
}    

猜你喜欢

转载自www.cnblogs.com/mufengforward/p/9178194.html