Enabling orphanRemoval on oneToMany relationship causes constraint violation

Description

Having a collection of oneToMany with orphanRemoval set to true removing element and adding new element can cause constraint violations because the INSERT is executed before the DELETE statement. This is a variation of HHH-6484.

Attached Maven project contains a simple setup to illustrate the problem.

Environment

None

Status

Assignee

Unassigned

Reporter

T

Fix versions

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Affects versions

Priority

Major
Configure