Re: Deleting objects causes OutOfMemory...
Re: Deleting objects causes OutOfMemory...
- Subject: Re: Deleting objects causes OutOfMemory...
- From: Lachlan Deck <email@hidden>
- Date: Thu, 17 May 2007 02:48:38 +1000
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@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden