Lets say I have an email
table which stands in relation to contact
and organization
tables. Contact
and Organization
objects can have several Email
children, and, the same Email
is not necessarily uniquely associated with any one parent. Relationships are accomplished via secondary tables. (I.e. contact_email
, and org_email
, which contain only foreign keys of the respective tables)
Mapped classes each possess functions that build instances from XML documents, and I would like a change in the XML to be reflected in the database. Specifically, when an email address is removed from, say, a Contact
, the row containing that address should be dropped from the contact_email
table. Moreover, if the email address no longer stands in relation to any other Contact
or Organization
instances, it should be deleted altogether.
How should this be accomplished?