Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-dev] Cascade Deletes through ManyToMany

One of the outstanding cascade delete support issues is with ManyToMany relationships like Employee-> Project. The delete in this case fails when constraints are present because the Project is deleted before Employee. We attempt to delete in this order because there is no dependency calculated on ManyToMany relationships so EclipseLink will use the reverse alphabetically order of the classes and delete project first. Deleting Project first results in constraint violations on the relationship table.

This issue exists beyond cascade delete as even if the user deleted the two object manually the constraint violation would still occur.

The easiest solution is to simply report the dependency on writable ManyToMany mappings but this may break previous applications that were dependent on the pseudo random ordering that EclipseLink used previously (some of our testing breaks).

Special code could be added to update the collection on cascade remove but there's no guarantee that the update may not be optimized out at some later date and it does not solve this issue when cascade delete is not used or JPA is not used.

I recommend we update the dependency.

--Gordon


Back to the top