Envers documentation: configuration of event listeners is incomplete for JPA:
@PostPersist, @PostUpdate @PostRemove no longer work
-----------------------------------------------------------------------------------------------------------------------------------
Key: HHH-3879
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3879
Project: Hibernate Core
Issue Type: Task
Components: envers
Affects Versions: 3.3.x, 3.5
Reporter: Erik-Berndt Scheper
The Envers documentation proscribes the following configuration for JPA:
<property name="hibernate.ejb.event.post-insert"
value="org.hibernate.envers.event.AuditEventListener" />
<property name="hibernate.ejb.event.post-update"
value="org.hibernate.envers.event.AuditEventListener" />
<property name="hibernate.ejb.event.post-delete"
value="org.hibernate.envers.event.AuditEventListener" />
However, this conflicts with chapter 2.3 Event listeners in the Hibernate Entitymanager
configuration, which states:
<quote form entitymanager documentation>
Hibernate Entity Manager needs to enhance Hibernate core to implements all the EJB3
semantics. It does that through the event listener system of Hibernate. Be careful when
you use the event system yourself, you might override some of the EJB3 semantics. A safe
way is to add your event listeners to the list given below.
<table skipped>
Note that the JACC*EventListeners are removed if the security is not enabled.
</quote form entitymanager documentation>
I have found that this is correct: when I use the proscribed configuration the following
JPA annotations no longer work: @PostPersist, @PostUpdate @PostRemove
To fix this, I have changed the configuration to:
<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" />
Please update the envers documentation accordingly.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira