Enable or Disable Auditing at Runtime

Task Summary

This task covers the configuration steps required to enable/disable entity version auditing at runtime.

Procedure 10.10. Task

  1. Subclass the AuditEventListener class.
  2. Override the following methods that are called on Hibernate events:
    • onPostInsert
    • onPostUpdate
    • onPostDelete
    • onPreUpdateCollection
    • onPreRemoveCollection
    • onPostRecreateCollection
  3. Specify the subclass as the listener for the events.
  4. Determine if the change should be audited.
  5. Pass the call to the superclass if the change should be audited.