If one table has several relations to another table delete action will not work properly. In such case delete action will be triggered for only one of the relations. So, in the case of multiple relations one should write his own cascading or restricting logic in the delete method.
An example can be found in Unit and UnitConvert tables. UnitConvert table has two relations to the Unit table – from unit and to unit. Table Unit has cascading delete action for the UnitConvert table. However, if a unit will be deleted, only unit conversions with from unit equal to the deleted one will be deleted. Conversions with to unit equal to the deleted one will survive.
Example of correct implementation can be found in InventTestEmplResponsible and EmplTable. EmplTable has delete method overridden to perform manual delete in the InventTestEmplResponsible table.
Delete actions and multiple relations
Views (3223)
This was originally posted here.

Like
Report
*This post is locked for comments