Re: Problem removing/deleting all related objects.
Re: Problem removing/deleting all related objects.
- Subject: Re: Problem removing/deleting all related objects.
- From: Ken Anderson <email@hidden>
- Date: Tue, 06 Mar 2007 17:36:25 -0500
David,
Because you're enumerating something that is being modified. An
approach might be to create a clone of scheduledBatches(), so that
you will iterate over an array that isn't changing.
Ken
On Mar 6, 2007, at 5:31 PM, David Avendasora wrote:
Hi all,
What could I be doing wrong that when I execute the following
method that it only deletes half of the relationships? It
alternates, deleting one, skipping one, deleting one, skipping one,
and so on....
I have a component with a submit button that calls the
deleteAllScheduledBatchesRelationships() method.
public void deleteAllScheduledBatchesRelationships() {
Enumeration objects = scheduledBatches().objectEnumerator();
while ( objects.hasMoreElements() )
deleteScheduledBatchesRelationship((ScheduledBatch)
objects.nextElement());
}
public void deleteScheduledBatchesRelationship(ScheduledBatch
object) {
removeObjectFromBothSidesOfRelationshipWithKey(object,
"scheduledBatches");
}
If I call this enough times, I'll get down to 1 relationship left,
which it won't delete.
I'm sure it is something VERY basic, but I just can't figure out
what it is.
Thanks!
Dave
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40anderhome.com
This email sent to email@hidden
_______________________________________________
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