Envers audit gives inconsistent behaviour depending on whether a @OneToMany collection of child objects is empty or not

Description

With @Version field auditing enabled (org.hibernate.envers.do_not_audit_optimistic_locking_field set to false)

If a parent object contains a @OneToOne relationship with a child object and a @OneToMany collection of other child objects, the behavior of envers audit when the @OneToOne child entity is modified, depends on whether the @OneToMany collection is empty or not.

Referring to code example:

if parent.address.name is modified:

and parent.children is not empty, @Version is incremented and audited. (this is desired behaviour for my usage)

if parent.children is empty @Version field is not incremented and not audited (this is undesired behaviour for my usage).

Literall the collection being empty or not affects the behaviour when other unrelated child entities are modified.

Activity

Show:

Details

Assignee

Reporter

Affects versions

Priority

Created May 5, 2022 at 6:09 PM
Updated May 5, 2022 at 6:09 PM

Flag notifications