deletion questions

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
tkilshaw
Posts: 170
Joined: Thu Jan 19, 2006 11:33 pm
Location: Western Canada
Contact:

deletion questions

Post by tkilshaw »

Suppose that you have objects Account and Company. They are peers. Account.Company is a 1 to 1 reference with matching attribute Company.Accounts, which is a many to 1.

If I find and delete a Company that has a reference to an Account, will it automatically be removed from the Account.Company attribute's value?

If I delete the Account , will it automatically be removed from the Company.Account's attribute's value?

I think the answer to those two questions is yes, but I'd like to know for sure.

Now, if Account and Contact are peers and Account.Contacts is a 1 to many reference to a Contact with matching attribute Contact.Accounts which is likewise 1 to many, if Account is deleted is it automatically removed from Contact.Accounts?

And if the Contact is deleted, is it automatically removed from Account.Contacts?

Again, I think so.

But, Account also has reference Account.MainContact, a peer 1 to 1 relation to a Contact, without a matching attribute in Contact. When a Contact is added to Account.MainContact it is also added to Account.Contacts.

When I delete a Contact that is currently in an Account do I first have to find and remove it from Account.MainContact before I delete the Contact?

If I don't do that what is the consequence? What will be visible, or what eror message will I get?

thanks,

Terry
aware_support2
Posts: 595
Joined: Sun Apr 24, 2005 2:22 am
Contact:

Post by aware_support2 »

Terry,

Matching attributes define the same link. Therefore, if the link is broken on one side it will be automatically broken on the other. For example, if you remove an Account from Company.Accounts, attribute Account.Company for the removed account will become undefined.

If you completely delete an instance then the link to it will be automatically removed from all reference attributes on all objects that point to this instance. For example, if Account.MainContact points to a Contact instance and the same instance is in Account.Contacts and in you delete the Contact instance, then it will be automatically removed from both Account attributes.

The automatic cleanup of links to deleted objects is a part of the Aware IM object framework. You do not need to manually remove an instance from any reference attributes before deleting the instance.
Aware IM Support Team
Post Reply