• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Problem removing/deleting all related objects.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
References: 
 >Problem removing/deleting all related objects. (From: David Avendasora <email@hidden>)

  • Prev by Date: Problem removing/deleting all related objects.
  • Next by Date: Re: Problem removing/deleting all related objects. SOLVED
  • Previous by thread: Problem removing/deleting all related objects.
  • Next by thread: Re: Problem removing/deleting all related objects. SOLVED
  • Index(es):
    • Date
    • Thread