On 17/05/2007, at 1:25 AM, Shravan Kumar.M wrote:

I have following Entities and their relationships:

A <---->> D
B <---->> D
C <---->> D

Now, from in EO class of 'A' I am trying to delete the entity 'D' objects as follows:

Are you also going to be deleting the 'A'? If so you could just adjust your cascading delete rules and forget the below. Otherwise...

public void deleteDs(){
NSArray dObjs = new NSArray(ds());//ds is a to-many relationship from A to D , A ---->> D
        for ( int i=0, count= dObjs.count(); i < count; i++ ) {
            D dObj = (D) dObjs.objectAtIndex(i);
            removeObjectFromBothSidesOfRelationshipWithKey(d, "ds");
        // or
                dObj.removeObjectFromBothSidesOfRelationshipWithKey(this, "a");
        }
        editingContext().saveChanges();
}

Problem:

1) Causing OutOfmemory when I do this operation.

Just how many objects are being deleted? Perhaps they need to be deleted in batches.

2) When editingContext().saveChanges(); is invoked, it is first fetching all the "D" objects as follows:
                SELECT dCol1,dCol2 FROM D WHERE c_d = 12345 .
Donno why select query is referring only to c_d and not including a_d and b_d which are foreign keys to C,A,and B tables respectively in D.

I believe that OutOfmemory is caused due to above fetch. Could you please suggest how to resolve this issue and why deleting of objects is fetching the objects in to the memory in an improper way.

Not sure - but it'll be checking for any changed conditions that may prevent the deletions.

It might be worth checking out these topics (conveniently hidden away these days :-/) http://developer.apple.com/documentation/LegacyTechnologies/ WebObjects/WebObjects_5/Topics/TopicsTOC.html
- Executing Arbitrary SQL Statements
- Deleting with the Adaptor Sublayer

with regards,
--

Lachlan Deck



_______________________________________________
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