Detecting transient state of mandatory toOne relations is broken

Description

The attached test-case shows that we get an TransientPropertyValueException when saving an entity, even though the referenced entity is clearly persisted before and should not be regarded as transient.
The bug seems to be introduced by and is closely related to that issue.

The new issues seems to appear when one entity is cached but the referenced entity is not (causing different DelayedPostInsertIdentifier handling for the two entities).

Environment

Spring-Boot 2.1, Java 8, Windows 10, H2DB

Assignee

Chris Cranford

Reporter

Florian Kirchmeir

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Worked in

5.3.6

Components

Affects versions

Priority

Critical
Configure