try catch导致@Transactional回滚失败

Posted penghq

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了try catch导致@Transactional回滚失败相关的知识,希望对你有一定的参考价值。

原因分析见:https://www.cnblogs.com/pjjlt/p/10926398.html

解决办法:catch中手动回滚。

try {
           
}catch (Exception e){
   //手动回滚
   TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
}

 

以上是关于try catch导致@Transactional回滚失败的主要内容,如果未能解决你的问题,请参考以下文章