Gavin King (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiNGEyOTM3N2Fi...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-16464?atlOrigin=eyJpIjoiNGEyOT...
) HHH-16464 (
https://hibernate.atlassian.net/browse/HHH-16464?atlOrigin=eyJpIjoiNGEyOT...
) Foreign key constraint not created for @OneToOne mapping with missing @MapsId (
https://hibernate.atlassian.net/browse/HHH-16464?atlOrigin=eyJpIjoiNGEyOT...
)
Issue Type: Bug Assignee: Unassigned Components: hibernate-core Created: 12/Apr/2023 04:23
AM Priority: Major Reporter: Gavin King (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
)
Given the following mapping:
@OneToOne
@JoinColumn(name = "id" )
private User user;
No foreign key constraint is created.
The fix is to add a @MapsId annotation, but this is not obvious at all.
Since we don’t reject this mapping, we should create the correct FK constraint even when
@MapsId is missing.
(
https://hibernate.atlassian.net/browse/HHH-16464#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16464#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 )