Gavin King (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiMTI5MTQ2MGU5...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-16463?atlOrigin=eyJpIjoiMTI5MT...
) HHH-16463 (
https://hibernate.atlassian.net/browse/HHH-16463?atlOrigin=eyJpIjoiMTI5MT...
) @PrimaryKeyJoinColumn ignored for @OneToOne mappings (
https://hibernate.atlassian.net/browse/HHH-16463?atlOrigin=eyJpIjoiMTI5MT...
)
Issue Type: Bug Assignee: Unassigned Components: hibernate-core Created: 12/Apr/2023 04:19
AM Priority: Major Reporter: Gavin King (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
)
Given the following mapping:
@OneToOne
@MapsId
@PrimaryKeyJoinColumn(name = "id" ) //ignored!
private User user;
The column name is simply ignored.
There are two possible workarounds:
* Remove @MapsId and add optional=false :
@OneToOne(optional = false )
@PrimaryKeyJoinColumn(name = "id" )
private User user;
* Use @JoinColumn instead of @PrimaryKeyJoinColumn
@OneToOne
@MapsId
@JoinColumn(name = "id" )
But my reading of the JPA spec is that the first example should work.
(
https://hibernate.atlassian.net/browse/HHH-16463#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16463#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100221- sha1:c4871f2 )