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 PROTECTED]
England                            (MIME welcome)


_______________________________________________
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]

Reply via email to