| Kieran,
The latest EOGenerator templates already have set<Rel>Relationship methods that do the proper thing for you.
In many cases, the regular set methods and KVC suffice. When you have a reciprocal relationship that has already been set, the relationship TO the other object that you set will have the right thing, but at save time, EOF is stuck because the data is inconsistent. What I would prefer is for EOF to raise an exception saying X -> Y != Y <- Z
Ken On Sep 19, 2006, at 2:33 PM, Kieran Kelleher wrote: Ken and Robert,
I _do_ see your point, but what got me is that the EditingContext _did_ show the new relationship, but the SQLw ritten to the db did _not_ implement it ..... at least if walking the object graph showed that the relationship did not exist. In any case, EOF is justified in requiring the addObjectToBothSides... method .... it is just that the takeValueForKey has worked reliably for a couple of years for so many other parts of the business logic.
Anyway, a hard lesson learned! I am off to take this "setKey" relationship method garbage out of my EOGenerator templates and regenerate and refactor.
Regards, Kieran
On Sep 19, 2006, at 2:20 PM, Robert Walker wrote:
On Sep 19, 2006, at 12:24 PM, Kieran Kelleher wrote: The SOLUTION was to change my code to use eoSourceObject.addObjectToBothSidesOfRelationshipWithKey( destObject, relationshipKey);
.....but WHY does not takeValueForKey or takeStoredValueForKey not set the relationship both ways?
Simple answer; because it was not designed to do that. And no this is not a bug. My only guess is that there was a reason the designers of EOF chose to implement it that way. Given that takeValueForKey is used not only for relationships, but also attributes would probably have something to do with this. Those KVC methods are not designed to manipulate relationships. The method addObjectToBothSidesOfRelationshipWithKey(object, relationshipKey) is provided for just this purpose.
_______________________________________________ Do not post admin requests to the list. They will be ignored. Help/Unsubscribe/Update your Subscription:
_______________________________________________ Do not post admin requests to the list. They will be ignored. Help/Unsubscribe/Update your Subscription:
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]