Batch order_inserts: flush during transaction causes incorrect insert ordering and subsequent constraint violation

Description

A flush during a transaction can cause the org.hibernate.engine.spi.ActionQueue.InsertActionSorter#sort implementation to produce an incorrect ordering with subsequent constraint violation.

A simple test case is attached.

Environment

None

Status

Assignee

Vlad Mihalcea

Reporter

AndersW

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

5.2.12

Priority

Major
Configure