@OneToOne Derived ID is null when returned by query when bidirectional

Description

Given the following entities:

When the following query is executed:
"SELECT f FROM Foo f"

Bar objects that get returned have a null ID (i.e., bar#foo == null)

This happens because the fix for sets ToOne#referenceToPrimaryKey for Bar#foo to false [1], which ultimately leads to the ID not being resolved. [2]

[1] https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/main/java/org/hibernate/cfg/OneToOneSecondPass.java#L227
[2] https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/main/java/org/hibernate/type/EntityType.java#L428-L439

Environment

None

Status

Assignee

Gail Badner

Reporter

Gail Badner

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure