public class A implements Serializable {
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY)
@JoinColumn(name = "A_ID")
private List<B> bList;
}
public class B implements Serializable {
@JoinColumn(name = "A_ID", referencedColumnName = "ID")
@ManyToOne(optional = false)
private A a;
}
At a great cost I was able to get Hibernate to leave the foreign key of table A inside B as null in a register update, but with orphanRemoval = true it should delete those records from table B, which is not happening . How do I solve this problem?