Transaction marked as rollback only: How do I find the cause

后端 未结 8 1665
深忆病人
深忆病人 2020-11-28 19:39

I am having issues with committing a transaction within my @Transactional method:

methodA() {
    methodB()
}

@Transactional
methodB() {
    ...
    em.pers         


        
8条回答
  •  不思量自难忘°
    2020-11-28 20:15

    To quickly fetch the causing exception without the need to re-code or rebuild, set a breakpoint on

    org.hibernate.ejb.TransactionImpl.setRollbackOnly() // Hibernate < 4.3, or
    org.hibernate.jpa.internal.TransactionImpl() // as of Hibernate 4.3
    

    and go up in the stack, usually to some Interceptor. There you can read the causing exception from some catch block.

提交回复
热议问题