I found different behavior in Oracle and H2 when using AuditReader.
Given is ClassA and ClassB. ClassA has a set of type ClassB which is an ElementCollection which means ClassB is an @Embeddable while ClassA is an @Entity.
Problem occures in following scenario:
1. Persist an object of type ClassA with one reference to an object1 of type ClassB.
2. Load object of type ClassA from db (entityManager), change the reference means remove object1 from set and add object2 of type ClassB to set
3. Update ClassA
4. Load object of type ClassA via AuditReader in newest revision.
Loaded object has one reference in Set which is object2 of type classB
Loaded object has two references in Set which are object1 and object2 of type classB.
In my opinion only the result from H2 is correct because in both tables object1 is marked with REV_TYPE=2 (Deleted) in latest revision.
In fact it leads to wrong results because the loaded object of type ClassA does not describe the correct state at this revision.
Seems that error was on our side. Ticket can be closed.
Sounds good , thanks for letting us know.