找到Hibernate-Enver重复事件侦听器

时间:2017-05-31 06:21:26

标签: apache-karaf hibernate-envers

Hibernate-core 5.10.2Hibernate-envers-5.10.2persistance.xml 如果我将hibernate.envers.autoRegisterListeners添加到true我得到了:

org.hibernate.event.service.spi.EventListenerRegistrationException: Duplicate event listener found
    at org.hibernate.event.service.internal.EventListenerGroupImpl.listenerShouldGetAdded(EventListenerGroupImpl.java:126)
    at org.hibernate.event.service.internal.EventListenerGroupImpl.appendListener(EventListenerGroupImpl.java:91)
    at org.hibernate.event.service.internal.EventListenerGroupImpl.appendListeners(EventListenerGroupImpl.java:85)
    at org.hibernate.event.service.internal.EventListenerRegistryImpl.appendListeners(EventListenerRegistryImpl.java:156)
    at org.hibernate.envers.boot.internal.EnversIntegrator.integrate(EnversIntegrator.java:86)
    at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:278)
    at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:452)
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:889)

如果我将flag设置为false,则不会出现上面的异常,但是对于_AUD表没有触发插入查询。 我正在使用安装了功能的Karaf 4.0.7:

<feature version="5.2.10.Final" >hibernate-orm</feature>
<feature version="5.2.10.Final" >hibernate-envers</feature>

任何人都可以帮我解决我的想法吗?

1 个答案:

答案 0 :(得分:0)

问题已解决。听众需要注册,我添加了:

<form>
  Quantity (between 1 and 5):
  <input type="number" name="quantity" min="1" max="5">
</form>