Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jboss 7 (envers 4) Unable to load class org.hibernate.envers.event.AuditEventListener

I port from hibernate Envers 3.6 to Envers 4.0. This new version doesn't have AuditEventListener. Old version requires: listeners

I can't find how to configure the new version.

like image 409
Vlada Avatar asked Sep 02 '11 08:09

Vlada


1 Answers

In version 4.0 :

<properties>
  <property name="hibernate.ejb.event.post-insert" value="org.hibernate.ejb.event.EJB3PostInsertEventListener,org.hibernate.envers.event.AuditEventListener" />
  <property name="hibernate.ejb.event.post-update" value="org.hibernate.ejb.event.EJB3PostUpdateEventListener,org.hibernate.envers.event.AuditEventListener" />
  <property name="hibernate.ejb.event.post-delete" value="org.hibernate.ejb.event.EJB3PostDeleteEventListener,org.hibernate.envers.event.AuditEventListener" />
  <property name="hibernate.ejb.event.pre-collection-update" value="org.hibernate.envers.event.AuditEventListener" />
  <property name="hibernate.ejb.event.pre-collection-remove" value="org.hibernate.envers.event.AuditEventListener" />
  <property name="hibernate.ejb.event.post-collection-recreate" value="org.hibernate.envers.event.AuditEventListener" />
</properties>

There is no need to add this in the persistence.xml.

These event listener are now registred automaticaly.

Check : http://www.warski.org/blog/2011/04/envers-and-hibernate-4-0-0-alpha2-automatic-listener-registration/

like image 192
user613465 Avatar answered Dec 30 '22 05:12

user613465