I'm using Spring Data JPA, I have a Category object as following:
@Entity(name="category")
public class Category {
@ManyToOne
private Category supercategory;
@OneToMany(mappedBy="supercategory")
private List<Category> subcategories;
// ...
}
Now, whenever I remove any supercategory the subcategories "supercategory_id" is not updated to NULL in MySQL.
I don't want to remove the subcategories, just to remove the relation, which is by nullifying the "supercategory_id" column in the DB.
Thanks.