It fetches since it needs to validateForDelete.
Two approaches off the top of my head are (1) having "One Sided
Relationship" from D to A and the d's related to A are returned by a
custom method that uses a fetch spec. See practical WebObject book
for info on one-sided relationships, and (2)
ERXEOAccessUtilities.deleteRowsDescribedByQualifier( .. );
Use (2) with care ... no EOF validation is performed and it directly
deletes the rows .... no editing context save.
HTH, Kieran
On May 16, 2007, at 11:25 AM, Shravan Kumar.M wrote:
Hi Group,
I have following Entities and their relationships:
A <---->> D
B <---->> D
C <---->> D
i.e., from entity 'D' to entities 'A', 'B' or 'C' it is a to-one
relationship and from other side to entity 'D' is to-many.
Now, from in EO class of 'A' I am trying to delete the entity 'D'
objects as follows:
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");
}
editingContext().saveChanges();
}
Problem:
1) Causing OutOfmemory when I do this operation.
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.
Looking forward to your valuable responses. Let me know if you need
any other information.
Thanks & Rgds,
Shravan Kumar.M
"Let us learn from the past to profit by the present,and from the
present to live better in the future."
--William WordsWorth
---------------------------------------------------------------
_______________________________________________
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/kieran_lists%
40mac.com
This email sent to [EMAIL PROTECTED]
_______________________________________________
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]