Search code examples
javadatabasehibernatehibernate-envers

is there a way to limit the audit log amount of Hibernate envers?


I am testing the functionality's of hibernate envers, I like the module but I don't want the audit tables to become too big. Can hibernate envers be configured in such a way that the audit table can never exceed a predefined number of audit rows?


Solution

  • There is nothing that Envers provides specifically.

    What a lot of users tend to do is use the ValidityAuditStrategy and then specify a partition scheme on the database based on the REVEND and REVEND_TSTMP fields.

    By doing that, you could setup a strategy where

    • You store the more recent audit rows on faster disk medium.
    • You archive off older audit rows based on the partition scheme.