I use Hibernate Envers with conditional logging. The documentation describes quite well how this can be done (http://docs.jboss.org/hibernate/orm/4.2/devguide/en-US/html/ch15.html#d5e4449). At 2nd item, it says you have to subclass the appropriate listeners.. The purpose of the three listeners EnversPostDeleteEventListener, EnversPostInsertEventListener and EnversPostUpdateEventListener is clear to me.
However, I am not quite clear what exactly is the purpose of the other three listeners EnversPreCollectionUpdateEventListener, EnversPreCollectionRemoveEventListener and EnversPostCollectionRecreateEventListener? When should I configure them? Can you give me an example?
That's when you have persistent collections, e.g. fields of type
List<String>
, orSet<EmbeddedComponent>
.