Given the following mapping:
{code:java}@OneToOne @JoinColumn(name = "id") private User user;{code}
No foreign key constraint is created.
The fix is to either:
* add a {{@MapsId}} annotation, or * add {{optional=false}}
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. |
|