22
這裏是源代碼:DELETE_ORPHAN和DELETE有何區別?
@OneToOne(fetch = FetchType.LAZY)
@Cascade({SAVE_UPDATE, EVICT, DELETE})
@JoinColumn(name = "A_ID", nullable = true)
private A a;
@OneToMany
@Cascade({SAVE_UPDATE, EVICT, DELETE, DELETE_ORPHAN})
@JoinColumn(name = "B_ID")
private List<B> bList;
是什麼DELETE_ORPHAN和DELETE的區別?
FYI:如果你的接口,Hibernate是JPA ** **,你能夠做到這與在'@ OneToMany'註解'orphanRemoval = TRUE;屬性自** JPA 2.0 **。請參閱http://stackoverflow.com/a/2928481/1029261 – rmoestl 2013-11-07 08:13:15