@OneToOne bidirectional mapping with @JoinColumn
问题 Let's say I have Person class Person{ @Id Integer id; @OneToOne @JoinColumn(name = "person_id") Job myJob; } and Job class Job{ @Id Integer id; Integer person_id; @OneToOne @PrimaryKeyJoinColumn(name = "person_id") Person currentWorker; } I'm not able to map the Person and Job to other Entity, when fetching. What mistake am I doing ? 回答1: Your code should be: @Entity public class Person implements Serializable { @Id Integer id; @OneToOne @JoinColumn(name = "id") Job myJob; } @Entity public