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