No, that is not possible, you must use the same Hibernate and Envers versions.
Is it possible to use Envers 4 with Hibernate 3?
-
12-12-2021 - |
Domanda
Currently, we are using the version 3.6.9.Final
for all our Hibernate libraries, including Hibernate Envers for our audit revisions.
We want to move to the 4.1.8.Final
version (to use the @Audited(withModifiedFlag = true)
among others things), but only for Hibernate Envers. Unfortunately, it does not seem to work. When I modify an @Audited
entity, Envers does not save the revision.
Maybe it's due to the definition of the listeners? With 3.6.9, I set the following properties in my hibernate.properties
file:
hibernate.ejb.event.post-insert=org.hibernate.ejb.event.EJB3PostInsertEventListener,org.hibernate.envers.event.AuditEventListener
hibernate.ejb.event.post-update=org.hibernate.ejb.event.EJB3PostUpdateEventListener,org.hibernate.envers.event.AuditEventListener
hibernate.ejb.event.post-delete=org.hibernate.ejb.event.EJB3PostDeleteEventListener,org.hibernate.envers.event.AuditEventListener
hibernate.ejb.event.pre-collection-update=org.hibernate.envers.event.AuditEventListener
hibernate.ejb.event.pre-collection-remove=org.hibernate.envers.event.AuditEventListener
hibernate.ejb.event.post-collection-recreate=org.hibernate.envers.event.AuditEventListener
As far as I know, the version 4 of Envers does not need these declarations anymore. Without them, I get no error, but the revision are not created. I can't set these declarations back, as the classes are not the same between v3 and v4 (especially org.hibernate.envers.event.AuditEventListener
that does not exist anymore).
So is there a way to make it work?
Soluzione