array fault firing from addObjectToBothSidesOfRelationshipWithKey(, )
array fault firing from addObjectToBothSidesOfRelationshipWithKey(, )
- Subject: array fault firing from addObjectToBothSidesOfRelationshipWithKey(, )
- From: Patrick Middleton <email@hidden>
- Date: Thu, 17 Jan 2008 16:25:16 +0000
Hi,
periodically people post to this list with problems where adding or
removing objects from a one-to-many relationship using
addObjectToBothSidesOfRelationshipWithKey(,) or
removeObjectFromBothSidesOfRelationshipWithKey(,) causes the an array
fault to fire in the owning object, fetching perhaps thousands of
objects unnecessarily. Believe it or not I'm still working in ObjC;
on 19 Apr 2007 I posted some code to this list, an EOF/ObjC
workaround for this which had a few limitations -- the one most
likely to cause problems being that it won't work with database
inheritance. Did anybody ever try porting that to EOF 5, or devise
another workaround for WO5.x?
In essence, what the code did was provide a small number of classes;
where the developer encounters some code where he knows that an
object is to be added or removed and that the owning object's to-many
relationship might be an unfired array fault and that firing the
fault normally could be undesirable, then the developer users one of
the classes, which temporarily sets itself as the owning object's
editing context's delegate; this object analyses
EOFetchSpecifications, and in the case of a fetch specification to
fetch the objects to clear the fault, it instead returns an array
containing the detail object of interest, and records that it has
done so. Subsequently, the developer can obtain a list of objects
that have had their relationships tweaked and which should be
refaulted, and tell the helper object to restore the owning object's
editing context's previous delegate.
Patrick
--
Patrick Middleton
OneStep Solutions plc
351 London Road Phone: +44 (0)1702 426400
Hadleigh Fax: +44 (0)1702 556855
Essex. SS7 2BT Email: email@hidden
England (MIME welcome)
_______________________________________________
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