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. |