Re: Making a fake EO
Re: Making a fake EO
- Subject: Re: Making a fake EO
- From: Gennady Kushnir <email@hidden>
- Date: Fri, 20 Feb 2009 01:00:01 +0300
I thank everybody for you replies.
> Why don't you want to store null? Is this a situation where you don't have
> control over the DB? Is there a DBA that is trying to impose extreme
> normalization?
I don't want null because on the other object in my database that may
be related to some employee or unrelated to employee (with null
foreign key) and also it may be related to vacant employee place. So I
need some third option to indicate that aside from pointing to real
employee or null.
The other problem is that I am taking the list of employees from
external database that is in use by another application which is not
under my control. So it is undesirable to have that Mr. Vacancy in
official reports.
>> So I want relationships pointing to "zero" which is not real primary
>> key for any row in database to return that fake EO in my WOapp.
>
> That is going to be very hard because EOF is automatically going to go to
> the Database to look up the instance that has a Primary Key of 0, and throw
> an error if it can't find it. It is possible with Wonder to have it just log
> the error and not terminate the application, but it is a scary hack if you
> are in control of the database.
Well in fact I came across that several times. When there was no
matching row row for foreign key EOF simply returned me an empty
Enterprise Object with all attributes set to null. And the only place
where I encountered an error was a NullPointerException when treating
unexpectedly NULL attribute values. And maybe when saving.
Well... by now I've only got that this is "The Hard Way™" ... but no
pointer to that way...
Maybe I should consider some other ideas...
_______________________________________________
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