今天发现个自己的bug,仔细排查后,发现根本原因我在service方法中抛出的异常被控制层的方法捕获了,所以后台页面也只是出现个错误提示,而数据却没有回滚。

解决方式:对自己抛出的异常使用try catch,catch中 使用  

TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();

这样就可以主动回滚了

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-02-09
  • 2022-02-09
  • 2021-07-12
  • 2021-05-25
  • 2022-02-20
  • 2021-08-08
猜你喜欢
  • 2022-12-23
  • 2022-02-07
  • 2018-05-24
  • 2022-12-23
  • 2021-08-11
  • 2021-06-01
相关资源
相似解决方案