Re: Owns Destination problem
Re: Owns Destination problem
- Subject: Re: Owns Destination problem
- From: Chuck Hill <email@hidden>
- Date: Tue, 19 Aug 2008 15:24:09 -0700
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.
I need more coffee. Or at this point maybe beer is the better answer.
Did I just say "maybe"?
Yes. AND I have it in black white, signed, dated, printed out, and
laminated.
MS ->>SR Cascade Delete Rule
SR->MS is required by SR
SR->MS Nullify Delete Rule
1) Create a new ManufacturingSchedule
2) saveChanges().
3) Create a new ScheduledRouting, assign the new
ManufacturingSchedule to it's manufacturingSchedule() relationship
using: addObjectToBothSidesOfRelationshipWithKey(object,
MANUFACTURING_SCHEDULE_KEY);
4) remove the ScheduledRouting from the ManufacturingSchedule using:
removeObjectFromBothSidesOfRelationshipWithKey(object,
SCHEDULED_ROUTINGS_KEY);
The "object" in 3 and 4 are different objects, right?
Yes, in 3 it is a ManufacturingSchedule and in 4 it is a
ScheduledRouting - I just copied the lines out of the _Entity.java
files so there would be no doubt that I'm doing the whole "both
sides" thing. Cuz I knew you'd ask.
;-)
5) saveChanges()
This gives me the validation exception. Should it work, or is this
actually the expected behavior?
I would expect it to work.
If I add a saveChanges() between steps 3 and 4, then it saves both
without any problem after the removal.
No matter how you slice it, that is buggy behavior. For once, it
might not be you. ;-)
Whew. Thank- HEY! Wait a minute . . . that, that, that... is about
accurate. I guess.
I'll file a bug with Apple.
Where's that beer?
In the fridge in the other room. About 12 feet away.
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