Re: refreshing and relationships
Re: refreshing and relationships
- Subject: Re: refreshing and relationships
- From: email@hidden
- Date: Mon, 16 Jan 2006 13:30:58 +0100
processRecentChanges()
gets called by saveChanges(). t does however not propagate changes to the
parent store like saveChanges() does.
It's role is to apply delete rules.
I find it to be a good idea to call
processRecentChanges() regularly. E.g. at the end of some kind of run loop.
Pierre
Dev WO <email@hidden>
01/16/2006 12:50 PM
|
To
| email@hidden
|
cc
| Tom Woteki <email@hidden>,
email@hidden, webobjects-dev-bounces+pierre.bernard=email@hidden
|
Subject
| Re: refreshing and relationships |
|
Hi Pierre,
I've red the API about processRecentChanges(), but I still
have a question as it may help me on a problem I have:
does processRecentChanges() will save to the datastore?
or is it just a way to get the correct array (if it has been edited) in
Tom's example?
Thanks
Xavier
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
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
**********************************************************************
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