Envers does not record change on ElementCollection with conditional auditing
09:01 21 Jan 2026

I have a class with a collection of enums mapped by

@ElementCollection(targetClass = MyEnum.class)
private Set theValues = new HashSet<>();

I implemented conditional auditing by defining an Integrator like described in https://thorben-janssen.com/conditional-auditing-hibernate-envers/. On commit, a criteria allows to audit the version (add an entry in the _AUD table) or to ignore this version. Later I will speek of "audited revision" or "not audited revision"

I am able to retreive the expected revisions in the audit but the values in 'theValues' are only valid if modified in an audited commit. let me explain...

  1. In commit 1, create an instance with theValues={A, B, C}, the revision is audited

  2. I can find the revision in the audit table, the values are fine

  3. In commit 2, change the values to {D, E} in a revision that is not audited

  4. There is still only one revision in the AUD table, with expected values

  5. In commit 3, change something else in a revision that is audited

  6. There are two revisions in the AUD tables, the values of both are {A, B, C}

I expected the last revision of the audit to have the values {D, E}

It looks like Envers is building a revision by applying the changes in the commit to the last audited revision.

Is there a way to build a revision by comparing the current object with the last audited revision ? Or am I missing something ?

I am using Envers 6.6.15 in a SpringBoot 3.5.0 context

hibernate hibernate-envers