No rollback for ConstraintViolationException in transactional service

后端 未结 1 578
故里飘歌
故里飘歌 2021-01-06 21:15

I\'ve a service method called add() which is annotated with @Transactional.

I call it but when a ConstraintViolationException occurs inside

1条回答
  •  再見小時候
    2021-01-06 21:57

    Ah, I see what happens. The ConstraintViolationException happens at commit time, after the method has been executed, when the transaction interceptor around your add() method tries to commit the transaction. Since it can't commit, obviously, the transaction is rollbacked. It can't to anything else.

    0 讨论(0)
提交回复
热议问题