We're updating the issue view to help you get more done. 

Selecting inverse OneToOne with additional selects in query wrongly produces null

Description

The scenario is pretty simple

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 @Entity(name = "EntityA") public static class EntityA { @Id private Long id; @OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL) @JoinColumn(name = "b_id") private EntityB b; } @Entity(name = "EntityB") public static class EntityB { @Id private Long id; @OneToOne(mappedBy = "b", fetch = FetchType.EAGER) private EntityA a; }

When doing a query like select a from EntityB b left join b.a a everything is ok and the EntityA object is returned as expected, but when also selecting another attribute like select b.id, a from EntityB b left join b.a a the query suddenly produces null instead of the EntityA object.

Environment

None

Status

Assignee

Christian Beikov

Reporter

Christian Beikov

Fix versions

Labels

None

backPortable

Backport?

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

5.3.4

Priority

Critical