Hibernate由于非活动事务而无法创建修订

时间:2018-03-03 14:47:49

标签: java spring hibernate hibernate-envers

当我尝试使用hibernate和envers保存实体时,虽然实体在数据库中存在,但审计日志不是,我得到以下异常:

Caused by: org.hibernate.envers.exception.AuditException: Unable to create revision because of non-active transaction
    at org.hibernate.envers.event.spi.BaseEnversEventListener.checkIfTransactionInProgress(BaseEnversEventListener.java:132)
    at org.hibernate.envers.event.spi.EnversPostUpdateEventListenerImpl.onPostUpdate(EnversPostUpdateEventListenerImpl.java:34)
    at org.hibernate.action.internal.EntityUpdateAction.postUpdate(EntityUpdateAction.java:264)
    at org.hibernate.action.internal.EntityUpdateAction.execute(EntityUpdateAction.java:211)
    at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:582)
    at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:456)
    at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:337)
    at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:39)
    at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1282)
    at org.springframework.orm.hibernate5.SessionFactoryUtils.flush(SessionFactoryUtils.java:144)
    ... 96 more

什么似乎是问题?

0 个答案:

没有答案