On 19 Apr 2007, at 13:37, Ken Anderson wrote:

Frank,

There must be a large number of objects in the relationship you're adding to. In that case, you might want to just add it to the other side. Is it a relationship that you use often? If so, you might want to consider changing how it works so that there's not such a large group of objects being returned.

In other words, if you have a to many with an opposite to-one:

A <-->> B

If you set B's to-one relationship to A (not using the both sides method), you won't trigger the to-many fault. Of course, if the to- many fault has already been triggered, you're going to have an inaccurate object graph. A hokey solution might be to test whether to to-many relationship from A to B is a fault or a real array, and then add in that direction if necessary.

Bottom line - I would change my relationships. Do you absolutely need this to-many relationship? Could it be handled with a fetch instead for a once in a while situation? A common misconception that people have is that they should model both directions of every relationship. Only model what you need...

Ken

On Apr 19, 2007, at 7:41 AM, Frank Stock wrote:

HI,

I did test it with addTo<relationsShipName> and that just gives me the same result!

...


On 19-Apr-07, at 4:50 PM, [EMAIL PROTECTED] wrote:



From: Frank Stock <[EMAIL PROTECTED]>
Date: 19 April 2007 4:50:08 PM GMT+05:30
To: [email protected]
Subject: AddObjectToBothSidesOfRelationshipWithkey


Hi,


When  I do this:

...
This will take 90 seconds to complete (will all the rest of the code)
                        

I can see in the debugger that every time I do a AddObjectToBothSidesOfRelationshipWithkey WO will perform a select-statement, the relations have a lot of records (>2000). I have to to that a lot of time and all I need is just to make a relation between the objects.
Why is WO performing a select every time and can I avoid that?

Frank Stock


Yes. I've seen this problem often enough myself, and changing the eomodel was not an option for me. Apart from anything else, I do need the inverse relationship. I've seen people manipulate relationships directly using public accessors rather than let addObjectToBothSidesOfRelationshipWithKey(,) or removeObjectFromBothSidesOfRelationshipWithKey(,) make those changes, and while I have seen this approach working, I think it is prone to error.

I've got a solution I like for this, but, as some of you will have heard ad nauseam, I'm still working with WO451/ObjC .

Attachment: OSPArrayFaultSuppressor.h
Description: Binary data

Attachment: OSPArrayFaultSuppressor.m
Description: Binary data

Attachment: OSPArrayFaultSuppressorRecord.h
Description: Binary data

Attachment: OSPArrayFaultSuppressorRecord.m
Description: Binary data


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