Re: refreshing and relationships
Re: refreshing and relationships
- Subject: Re: refreshing and relationships
- From: email@hidden
- Date: Mon, 16 Jan 2006 09:14:41 +0100
Hi!
Rather than deleting the object manually
I would suggest you configure the delete rule of your relationship to your
liking. With an "owns destination" relationship a call to removeObjectFromRelationshipWithKey
will remove the object from the array and subsequently delete it.
A call to EOeditingContext.processRecentChanges()
will trigger the actual processing of such delete rules.
Pierre
Tom Woteki <email@hidden>
Sent by: webobjects-dev-bounces+pierre.bernard=email@hidden
01/15/2006 06:33 PM
|
To
| email@hidden
|
cc
|
|
Subject
| refreshing and relationships |
|
I'm stumped. I guess I'm just overlooking something
very obvious. I'm
hoping that some wiser head hereabouts can help me. Thanks in advance.
My problem is not the usual one implied by the subject line. I am
_not_ trying to refresh data in a to-many relationship that may have
been changed in another object store. For purposes of my problem you
can assume there is only one object store, one editing context (the
session's default) and one user involved.
I have a source object, sourceObj, with a to-many relationship. Say
the relationship key is "targets" . I obtain the related objects
by
invoking sourceObj.targets() where the method targets() returns an
NSArray as a cover for a call to storedValueForKey( "targets"
).
I now invoke:
/* Assume editingContext exists and all EOs are in it */
editingContext.deleteObject( aSpecificTargetObject )
Upon subsequent invocations of targets() (and prior to saveChanges())
the returned array contains the target object I just deleted. This is
my problem: I think that object should no longer be in the array.
It seems the only way I can see the effects of the deletion is by
executing this sequence:
editingContext.deleteObject( aSpecificTargetObject );
editingContext.saveChanges();
editingContext.refreshObject( sourceObject ); /* If I don't do this I
still see the deleted object */
However, I don't want immediately to save the changes, so this
approach is unsatisfactory to me. (And I prefer not to use display
groups.)
Any ideas?
Thanks
Tom
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
**********************************************************************
This email and any files transmitted with it are intended solely for
the use of the individual or entity to whom they are addressed.
If you have received this email in error please notify the sender
of this message. (email@hidden)
This email message has been checked for the presence of computer
viruses; however this protection does not ensure this message is
virus free.
Banque centrale du Luxembourg; Tel ++352-4774-1; http://www.bcl.lu
**********************************************************************
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden