Re: Owns Destination problem
Re: Owns Destination problem
- Subject: Re: Owns Destination problem
- From: Chuck Hill <email@hidden>
- Date: Wed, 20 Aug 2008 11:18:50 -0700
On Aug 20, 2008, at 3:50 AM, David Avendasora wrote:
On Aug 19, 2008, at 10:31 PM, Lachlan Deck wrote:
On 20/08/2008, at 8:24 AM, Chuck Hill wrote:
On Aug 19, 2008, at 2:07 PM, David Avendasora wrote:
On Aug 19, 2008, at 4:43 PM, Chuck Hill wrote:
On Aug 19, 2008, at 12:22 PM, David Avendasora wrote:
Noooooo! Sob. Sniff.
This does sound really similar, but I'm not convinced yet that
what I'm doing _should_ work. Here's the exact flow. I'm the
only one using the app and I'm using the Default Editing Context.
For review:
ManufacturingSchedule <->> ScheduledRouting
MS->>SR Owns Destination
I don't think this does anything for to-many relationships. The
interplay between Owns Destination and Cascade Delete has always
seems confusing to me.
In this situation, Owns Destination is what I'm counting on
triggering the deletion of the a ScheduledRouting when the
ScheduledRouting's relationship to ManufacturingSchedule is made
null - which is very counter-intuitive, because how does the
ScheduledRouting know about ManufacturingSchedule's "Owns
Destination" relationship back to it?
It would happen, I'd think, in
removeObjectFromBothSidesOfRelationshipWithKey. But I am
uncertain if that works with to-many.
Why not simply ec.deleteObject(scheduledRoutingToDelete); ?
Rather than removingFromBothSides then saving. Delete, save...
you'll find it's removed :-)
Good point, but the ScheduledRouting is really the top of a
hierarchy that cascades down from there. ScheduledRouting Cascade
Deletes both ScheduledBatch and
ScheduledManufacturingOrderItemRouting, SMOIR Cascade Deletes
ScheduledManufacturingOrderItems.
With the problem I'm having, If I delete the ScheduledRouting,
instead of that Cascading down, I get the validation error on
ScheduledBatch that it must have a ScheduledRouting. So it's the
same problem, just pushed down another level.
That is a (or the same) bug.
By relying on WO's Cascading Delete and Owns Destination I should be
able to simply set one relationship to null and have 50+ instances
of various other objects deleted automatically.
Yes, that should work.
If I do it all manually, I'm going to end up writing a lot of for-
loops to walk through toMany relationships to do all the deleting.
Ugh.
Chuck
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
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