Re: Deletion Confusion
Re: Deletion Confusion
- Subject: Re: Deletion Confusion
- From: Chuck Hill <email@hidden>
- Date: Fri, 7 Jan 2005 18:30:26 -0800
On Jan 7, 2005, at 1:55 PM, James Cicenia wrote:
Hello -
I am baffled, tired, or both.
Baffled usually follows tired pretty closely IME.
I have the following structure with the shown relationships:
Project -->> Phases -->>Tasks
I need to temporarily purge all Phases and Task.
Your use of the word 'temporarily' makes me uneasy. How do you
temporarily delete objects? Have you discovered object reincarnation?
:-P
Is there a simple one line that I am missing that will do this?
ec.deleteObject(project);
Which I suspect is not what you want to do.
Do I have to walk through both Phases and Tasks or is
Phases good enough because of the cascade rule?
Phases is good enough. If the Project ->> Phases relationship is set
to owns destination, then
project.setPhases(new NSMutableArray());
might do it in one line. I don't know if that will work, seems like it
should.
ALSO, when I was iterating over the relationship to delete
each object, the set total kept getting smaller so it would never
delete all the records. It would always leave two. I thought enumerator
would solve that, but no go.
No. You can't modify a collection that you are enumerating. You need
to make a copy:
NSArray copyOfPhases = new NSArray(project.phases());
and enumerate that.
Any help would be great.. too tired to see what I am doing wrong here.
Hope that helped.
Chuck
--
Practical WebObjects - a book for intermediate WebObjects developers
who want to increase their overall knowledge of WebObjects, or those
who are trying to solve specific application development problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
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