Envers Collection revision entries don't include deletes on detached entity saveOrUpdate

Description

Please see http://community.jboss.org/thread/175787?tstart=0

When a detached entity has some children removed by replacing the collection of children with a smaller collection, the audit entries do not contain the deletes when performing a saveOrUpdate. Using merge does include the correct delete revisions.

e.g

Parent contains children Child(A) and Child(B)

Parent -> (ChildA, ChildB)

If this collection is replaced with a new collection:

Parent -> (ChildA)

And a saveOrUpdate is issued on the parent, the audit entries doesn't include the delete for ChildB.

However, if the child is explicitly removed from the collection:

Parent.getChildren().remove(ChildB)

The saveOrUpdate works as expected and the delete of ChildB is audited correctly.

Using merge instead of saveOrUpdate allows the collection of children to be replaced rather than an explicit removal, and audit entries correctly register the delete of ChildB.

I have not tested this beyond 3.6.8.Final.

I have attached a spring/maven test case. Any questions let me know.

Karl

Environment

None

Assignee

Chris Cranford

Reporter

Karl Walsh

Fix versions

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure