Hi Kieran/Group,
1) Actually the SELECT query generated by EOF when I instruct it to
delete objects is seems to be wrong.
2) There are just 100 D records which am trying to delete. But due to
a wrong SELECT query fired by EOF, 1000's of records are fetched in
to memory and resulting OutOfMemory. Donno how this wrong query is
generated by EOF. I think if we can fix this query issue, we'll get
some solution.
Main issue with query is, the wrong join it made in the below query.
If you can tell me how EOF decides on which join to make while
constructing SELECT query during deleting objects. I will try to
debug in those lines.
SELECT dCol1,dCol2 FROM D WHERE d_c = 12345 .
Structure of D table:
~~~~~~~~~~~~~~~~~~
d_id pk
d_a fk to A table
d_b fk to B table
d_c fk to C table
Am running this app on a dev machine... with default java Xms and Xmx
args
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
---------------------------------------------------------------
On 17-May-07, at 4:32 PM, Kieran Kelleher wrote:
1) About how many D items at the end of the relationship?
2) What is your memory settings for the app (Xms and Xmx args)
On May 17, 2007, at 2:36 AM, Shravan Kumar.M wrote:
Thanks for your reply Kieran,
Ok... actually removeObjectFromBothSidesOfRelationshipWithKey,
does delete the D objects, when saveChnages() on editingContext is
invoked.
anyway I also tried as following, but it does same job and leading
to OutOfMemory...
------------------------------------------
EOKeyValueQualifier stsrQual = new EOKeyValueQualifier
("d_a", EOQualifier.QualifierOperatorEqual, this); //where, d_a is
a foreign key in D to A entity.
EOFetchSpecification fs = new EOFetchSpecification
("D",stsrQual,null);
NSArray dObjs = editingContext
().objectsWithFetchSpecification(fs); // D records for this A object.
int dObjsCnt = dObjs.count();
for(int i = (dObjsCnt-1); i > 0; i--)
{
D currentD = (D) dObjs.objectAtIndex(i);
editingContext().deleteObject(currentD);
}
editingContext().saveChanges();
------------------------------------------
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();
}
any suggestion on how to improve this process or get away from
OutOfmemory problems are welcome.
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
---------------------------------------------------------------
On 16-May-07, at 9:39 PM, Kieran Kelleher wrote:
Actually scrap (1) ...... what is probably happening is a domino
effect of validateForDelete on relationships ...
.... and scarp (2) since you are just removing form
relationships, not really deleting, right?
Sorry, late night working last night .... need more coffee.......
Kieran
On May 16, 2007, at 12:03 PM, Kieran Kelleher wrote:
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/
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]