Given the following mapping:
{code:java}@OneToOne @MapsId @PrimaryKeyJoinColumn(name = "id") //ignored! private User user;{code}
The column name is simply ignored.
There are two possible workarounds:
# Remove {{@MapsId}} and add {{optional=false}}: {code:java}@OneToOne(optional = false) @PrimaryKeyJoinColumn(name = "id") private User user;{code} # Use {{@JoinColumn}} instead of {{@PrimaryKeyJoinColumn}} : {code:java}@OneToOne @MapsId @JoinColumn(name = "id"){code}
But my reading of the JPA spec is that the first example should work. |
|