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...
In commit 1, create an instance with theValues={A, B, C}, the revision is audited
I can find the revision in the audit table, the values are fine
In commit 2, change the values to {D, E} in a revision that is not audited
There is still only one revision in the AUD table, with expected values
In commit 3, change something else in a revision that is audited
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