您的代码应为:
@Entitypublic class Person implements Serializable { @Id Integer id; @oneToOne @JoinColumn(name = "id") Job myJob;}@Entitypublic class Job implements Serializable { @Id Integer id; @oneToOne(mappedBy = "myJob") Person currentWorker;}(尝试从工作中删除重复的列’person_id’)
或其他共享主键的方法:
@Entitypublic class Person { @Id Integer id; @oneToOne(cascade = CascadeType.ALL) @PrimaryKeyJoinColumn Job myJob;}@Entitypublic class Job { @Id Integer id;}


