Re: Error with Cross-Model/Database Relationship
Re: Error with Cross-Model/Database Relationship
- Subject: Re: Error with Cross-Model/Database Relationship
- From: Chuck Hill <email@hidden>
- Date: Tue, 2 Dec 2008 10:40:26 -0800
On Dec 2, 2008, at 9:29 AM, David Avendasora wrote:
Hi,
I just want to make sure I understand the error I'm getting and if
it is to be expected, or if it _should_ work, but I'm messing
something else up.
I have the following relationship:
ExternalLotCode <<-> LotCode
Each entity is in a different EOModel, AND in a different Database.
When I fetch records from ExternalLotCode, I see the following SQL
execute:
Dec 02 12:13:47 BakeryManagementJavaClient[61270]
(ERXNSLogLog4jBridge.java:46) DEBUG NSLog - evaluateExpression:
<com.webobjects.jdbcadaptor.MicrosoftPlugIn$MicrosoftExpression:
""SELECT t0.External_Lot_Code_ID, t0.External_Lot_Code_Value,
t0.Lot_Code_ID FROM dbo.MSDynamics_Lot_Code t0 WHERE
UPPER(t0.External_Lot_Code_Value) LIKE UPPER(?) ESCAPE '\'"
withBindings: 1:"8P31808269%"(externalLotCodeValue)>
Which, based on the following, it seems to be working just fine so
far:
Dec 02 12:13:48 BakeryManagementJavaClient[61270]
(ERXNSLogLog4jBridge.java:46) DEBUG NSLog - 45 row(s) processed
But when EOF then goes to select (fault?) the related LotCode
record, I get the following error:
Dec 02 12:13:48 BakeryManagementJavaClient[61270]
(ERXDatabaseContextDelegate.java:153) INFO
er.transaction.adaptor.Exceptions - Database Exception occured:
java.lang.IllegalStateException: The object with globalID
_EOIntegralKeyGlobalID[LotCode (java.lang.Long)143937] could not be
found in the database. This could be result of a referential
integrity problem with the database. An empty fault could not be
created because the object's class could not be determined (e.g. the
GID is temporary or it is for an abstract entity).
There _is_ a corresponding record in the Lot_Code table that has
143937 as the PK. I'm assuming that EOF is choking on it because the
Lot_Code table is in a different database than what
"External_Lot_Code" is in.
This is a simple one-attribute PK to FK relationship. No fancy
qualifiers or anything else.
Should this work or no?
Probably? Let's take a look at the error message:
An empty fault could not be created because the object's class
could not be determined (e.g. the GID is temporary or it is for an
abstract entity).
The GID is not temporary. Is LotCode abstract? Just covering off the
blatantly obvious here.
Is there a full stack trace you are hiding from us? It also might be
that EOF is looking in the wrong object store.
Chuck
On Dec 2, 2008, at 10:26 AM, Mike Schrag wrote:
On Dec 2, 2008, at 7:21 AM, David Avendasora wrote:
Shouldn't EOF recognize that the tables are in two different
databases and not try to do one select statement that "joins" them?
If I have EntityA in database 1, and EntityA in database 2, and a
relationship between them, and try to do a fetch whose qualifier
crosses the relationship it will fail.
We run into this a lot because we have tables in many different
Oracle schemas.
I think Mike had some ideas about a possible patch for this, but
then again I seem to remember the result was to run away.
There is no real "patch" for this ... You can make it not fail, but
you'll never really make it "nice". My idea for it stems from the
work i did on the IMAP EOF Adaptor, where you have a problem along
of a similar type, which is that IMAP supports evaluating SOME
types of qualifiers on the server, but not the full set of EO
qualifiers. To expose a nice interface to IMAP, you have to
basically write a join system in-memory that has pluggable
optimizers of which some can be implemented on the server and some
in-memory with post processing. I actually have a bunch of pieces
of this laying around, but nothing that made it into a final form,
but this is another one that can definitely be done, it's just
going to be ugly.
ms
_______________________________________________
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
_______________________________________________
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
--
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