Search code examples
javaspringhibernatehibernate-envers

hibernate envers 4: enable delete listenert


I need your help: I'm using hibernate envers 4.1.12 and I would like to enable only the delete listener, but I'm not able to do it. I know that starting from hibernate 4 there is no longer need to declare the listener in the configuration file, but by default all the operations are triggered in the audit tables and I need to monitor only the delete ones.

Could you help me?

Thanks in advance.


Solution

  • Take a look at the Conditional audition section in the manual.

    What you essentially need to do is:

    • turn off automatic listener registration
    • write a custom Integrator, which uses only the delete listener (basing on the EnversIntegrator)
    • setup the integrator