标签: hibernate jpa one-to-one hibernate-cascade
@OneToOne和Parent之间有Child单向关系。当Parent正在合并时,我想删除Child,当提供Child时,对象与数据库中存在的对象不同。这是我在Parent课程中的关系:
@OneToOne
Parent
Child
@OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true) @JoinColumn(name = "object_id") private Child child;