I have a Department entity which relations are as follows:
Many departments can be in one parent department:
@ManyToOne @JoinColumn(name = "ik_parent_department_id") private Department parentDepartment;
One parent department can have many departments:
@OneToMany(mappedBy = "parentDepartment") private Set<Department> children = new HashSet<Department>(0);
And I want to implement the next: When I delete a department, then the ik_parent_department_id parameter of all children of this department is set to null. Any ideas how to do that?