Hibernate many-to-many remove relation
The CascadeType.REMOVE
doesn't make sense for many-to-many
associations because when set on both sides it could trigger a chain deletion between parents and children and back to parents. If you only set it on the parent side, you could bump into issues when a deleting child is still referenced by some other parents.
To quote the Hibernate docs:
It does not usually make sense to enable cascade on a many-to-one or many-to-many association. In fact the @ManyToOne and @ManyToMany don't even offer a orphanRemoval attribute. Cascading is often useful for one-to-one and one-to-many associations.