Select via Criteria API does not properly retrieve one to one reference
Given the following entity classes:
and instances created and persisted with
The following query created via the Criteria API fails to retrieve the referenced EntityTwo, i.e. the test fails at the line indicated by a comment:
Interestingly the generated SQL statement looks correct:
I'll make a reproducer available in a moment.
Is that PR available as a Snapshot somewhere? The build fails on my machine
Can you check if the fix in resolves your issue?
The mapping with @MapsId @JoinColumn(name = "id") seems to be essential to reproduce the issue.
Related Spring Data JPA issue: