Re: Modeling an optional to-one relationship
Re: Modeling an optional to-one relationship
- Subject: Re: Modeling an optional to-one relationship
- From: Chuck Hill <email@hidden>
- Date: Wed, 13 Jan 2010 17:17:36 -0800
On Jan 13, 2010, at 5:08 PM, Mark Ritchie wrote:
On 13/Jan/2010, at 4:07 PM, Lon Varscsak wrote:
Sighing is not allowed on the list. ;)
Apparently you're having a different day then I am! ;-)
I sent an example a few minutes ago. Yes, that does sound like
what I'm describing.
Your message and mine crossed paths... ;-)
Thanks for posting the example, that makes it so much more clear.
In the Movies.eomodel that I have, the TalentPhoto.photo is
optional. I see that you'd like the TalentPhoto record to not exist
when there is no photo however it looks like current example would
like to see the record. Lately I've not tried something like that
however I do recall that WOF's behaviour in this regard was changed
a while back (circa 2000/2001). There was a fix posted to restore
the original behaviour but it looks like that didn't survive the
ObjC to Java conversion. It was posted by Kelly Hawk and was
released with the Netstruxr's framewords (what later became project
wonder.)
I'm guessing that you'd have to implement an EODatabaseContext
delegate and implement
databaseContextFailedToFetchObject() to avoid having WOF's default
behaviour which is probably to throw a hissy fist as Chuck so
quaintly put it. ;-) Details are here: http://tr.im/dcdelegate
or here if the above trimmed url doesn't work:
http://developer.apple.com/legacy/mac/library/documentation/InternetWeb/Reference/WO542Reference/com/webobjects/eoaccess/EODatabaseContext.Delegate.html#databaseContextFailedToFetchObject(com.webobjects.eoaccess.EODatabaseContext, java.lang.Object, com.webobjects.eocontrol.EOGlobalID)
Good luck and thanks for the flashback to ObjC WOF that you
posted! ;-)
The Obj-C implementation is hazy in my memory. In Java, rather than
throwing a hissy fit, it will create a "dummy fault EO". That is, an
EO with all null values and no real existence. What Lon wants is a
real null, not a dummy EO. Kelly Hawk's fix was to throw an exception
(the old behavior) rather than return some insane zombie EO. That fix
(thanks Kelly!) is still in my Java code and I think lurking in Wonder
somewhere too.
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