relation not flushed when collection created after persist with enhanced entities

Description

When a collection is only created after the owning entity has been persisted, a change to that collection is not made persistent.
The attached test case (run with "mvn test") produces:

When run without enhancement or when the collection is created before flush (see comment in unit test), the test produces the expected outcome.

I don't know, if this was ever supported, or whether we just relied on unsupported behaviour until now. Would you please take a look?

Environment

None

Status

Assignee

Luis Barreiro

Reporter

Alexander Pinske

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Affects versions

Priority

Major
Configure