Allowing cascade remove to work on ManyToMany mappings is an extended feature
that goes beyond the spec.
There is an issue with the current implementation that could be addressed.
When a bidirectional ManyToMany mapping is set-up, the non-owning side is set
as read only.
When we calculate commit order, we do not add any dependancies based on
ManyToMany mappings. As a result, if the readOnly side is chosen to be deleted
first in our commit order, we will not remove the entry from the relation table
before removing the item. This will cause a constraint dependancy error on the
Changing the order of the mappings in the commit order, could be as simple as
changing the class name since the initial sort is done alphabetically.
Fixing this should be a matter of adding a constraint dependancy from the
Owning to the non-Owning side when we set up the mapping.
This make simple cascade remove of ManyToMany mappings work. There will likely
be some issues with cycles. (e.g. if you add a OneToOne mapping between the
same to entities like in the relationship between Employee and Project in our
advanced test model.) This issue is much more difficult to solve and is likely
part of the reason, Cascade Delete on ManyToMany is not required by the