当前位置: 代码迷 >> 综合 >> Could not commit JPA transaction; nested exception is javax.persistence.RollbackException
  详细解决方案

Could not commit JPA transaction; nested exception is javax.persistence.RollbackException

热度:51   发布时间:2024-03-08 10:35:00.0

错误原因:

内层事务抛出异常标记回滚,外层事务catch了异常以后没有抛出。

解决方法:

在外层事务的代码里往外抛出去或者手动回滚。

手动回滚:TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();

  相关解决方案