I have a problem with a self bidirectional relationship does not work cascade remove, i have the following entity that what it does is basically put together a family tree with many levels, if I try something like em.remove (family) it does not remove the children and catch that exception "integrity constraint violated - child record found"
public class Family{
@Id
public Long id;
public String name;
@ManyToOne
@JoinColumn(name = "id_father")
public Family father;
@OneToMany(cascade = CascadeType.REMOVE, orphanRemoval = true)
@JoinColumn(name = "id_father")
public List<Family> children;
//getters setters
//hashcode equals
}
Table
id
name
id_father