Quantcast

Using DataBinder with Hibernate Envers

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Using DataBinder with Hibernate Envers

Tobi
Is it possible to configure DataBinder to work with Envers?  I've tried adding the properties required by envers to the DataBinder class where annotated Hibernate classes are configured-but I'm not managing to invoke the org.hibernate.envers.event.AuditEventListener

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Using DataBinder with Hibernate Envers

rhansen
Yes,

You are probably not configuring envers correctly; what version of hibernate / envers?

you would need to make sure your hibernate.cfg.xml  has:

     <listener class="org.hibernate.envers.event.AuditEventListener" type="post-insert" />
    <listener class="org.hibernate.envers.event.AuditEventListener" type="post-update" />
    <listener class="org.hibernate.envers.event.AuditEventListener" type="post-delete" />
    <listener class="org.hibernate.envers.event.AuditEventListener" type="pre-collection-update" />
    <listener class="org.hibernate.envers.event.AuditEventListener" type="pre-collection-remove" />
    <listener class="org.hibernate.envers.event.AuditEventListener" type="post-collection-recreate" />

or add it whichever way you are working with it.
----
Rodolfo Hansen
KindleIT Software Development S.R.L.
www.kitsd.com
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Using DataBinder with Hibernate Envers

Tobi
The version of Hibernate is 3.3.1, the envers version is 1.2.2.GA-hibernate-3.3

The annotations to configure it with with Hibernate are in a class that extends AuthDataApplication in the configureHibernate(AnnotationConfig cfng) method.

I add the properties here like so:

cfng.setProperty("hibernate.ejb.event.post-insert", "org.hibernate.ejb.event.EJB3PostInsertEventListener,org.hibernate.envers.event.AuditEventListener,gov.ssp.listeners.DataChangeListener");

one for each of the events.  It's a little tricky to debug, because I'm not seeing any errors.  There is a hibernate.properties file on the classpath, and I've also added the same properties there, but no persistence.xml to speak of.  
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Using DataBinder with Hibernate Envers

Tobi
I forgot to add that hibernate.cfg.xml isn't being used, which is why I tried adding both to hibernate.properties and inconfigureHibernate()
Loading...