在平时的业务难免会遇到

  sql异常。 有些业务会涉及

  一个方法多个操作例如 

  dao.update() 1

  dao.save(); 2

  如果1正常,2不正常。默认是不回滚的。

  所以在这个地方要手动处理

  try  throw 的时候 ,不要抛 SQLException Exception 均不会回滚。亲测

      源码 DefaultTransactionAttribute

spring 事务回滚。

spring 事务回滚。

     自己自定义异常,throw runtimeException即可。并做好log记录。

 

相关文章:

  • 2022-02-13
  • 2022-12-23
  • 2021-06-10
  • 2022-01-08
  • 2021-04-26
  • 2022-01-08
猜你喜欢
  • 2022-12-23
  • 2021-07-29
  • 2021-12-21
  • 2022-02-21
  • 2021-10-07
  • 2021-12-12
相关资源
相似解决方案