CascadeType.ALL 对于@ManyToOne JPA 关联的含义是什么?
2022-08-31 05:17:57
我想我误解了在关系背景下级联的含义。@ManyToOne
具体案例:
public class User {
@OneToMany(fetch = FetchType.EAGER)
protected Set<Address> userAddresses;
}
public class Address {
@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
protected User addressOwner;
}
的含义是什么?例如,如果我从数据库中删除某个地址,那么我添加该地址的事实如何影响我的数据(我猜)?cascade = CascadeType.ALL
cascade = CascadeType.ALL
User