@Entity
public class Foo {
@Id
@ManyToOne
@JoinColumn(name = "key", nullable = false)
private int externalKey;
@Column
private String value;
...
}
Принимает вид:
@Entity
public class Foo {
@Embeddable
public static class Pk implements Serializable {
@ManyToOne
@JoinColumn(name = "key", nullable = false)
private int externalKey;
...
}
@Column
private String value;
@EmbeddedId
private Pk pk;
...
}