Re: EOF Inheritance problems help
Re: EOF Inheritance problems help
- Subject: Re: EOF Inheritance problems help
- From: Alan Ward <email@hidden>
- Date: Fri, 18 May 2007 11:53:54 -0600
we do this.
Alan
On May 18, 2007, at 11:43 AM, Chuck Hill wrote:
On May 17, 2007, at 11:21 PM, Lachlan Deck wrote:
Hi there,
first up, can inheritance cross model boundaries? i.e., if I have
ModelA and ModelB both of which have different connection
dictionaries (to different databases) can EntityB in ModelB
inherit from EntityA in modelA?
I _think_ that should work _but_ as a rarely used feature, I would
not be surprised to find bugs here. It works just fine if they are
both in the same database but in different models.
If the answer is no then the below is irrelevant - but if yes,
then I need some help with the below...
I have 3 models in my project (+ a Prototypes model of course):
- Willow: maps to database_1
- BinaryData: maps to database_2
- AnotherIrrelevantOne: maps to database_3
I have some abstract entities (defined in the Willow model)...
WillowEntity (Abstract no table mapping, has some common attributes)
|
__ ClientEntity (Abstract, mapped to ClientEntity table, adds an
additional fk and relation to Client)
|
__ Client (concrete)
<...>
BinaryData model:
BinaryData (inherits from WillowEntity).
At application runtime I'm setting the relevant connection
dictionaries for the various models (except the prototypes model).
Now the problem I'm seeing is that when I'm trying to save a
Course for some reason EOF is attempting to find the next primary
key for the table BinaryData(!) but in the Willow database!
Any ideas why that would happen? (See below)
That must happen. All the PKs in an inheritance hierarchy must
come from the top parent entity so that the EOGlobalIDs are unique.
with regards,
--
[2007-05-18 15:43:53 EST] <WorkerThread3> === Begin Internal
Transaction
[2007-05-18 15:43:53 EST] <WorkerThread3> finding primary key
value for WillowEntity
[2007-05-18 15:43:53 EST] <WorkerThread3> evaluateExpression:
<com.webobjects.jdbcadaptor.MySQLPlugIn$MySQLExpression: "SELECT
PK FROM EO_PK_TABLE WHERE NAME = 'WillowEntity' FOR UPDATE">
[2007-05-18 15:43:53 EST] <WorkerThread3> fetch canceled
[2007-05-18 15:43:53 EST] <WorkerThread3> 1 row(s) processed
That seems correct.
Where is this "finding maximum primary key value for WillowEntity"
from?
[2007-05-18 15:43:53 EST] <WorkerThread3> finding maximum primary
key value for WillowEntity
[2007-05-18 15:43:53 EST] <WorkerThread3> evaluateExpression:
<com.webobjects.jdbcadaptor.MySQLPlugIn$MySQLExpression: "SELECT
MAX(id) FROM BinaryData">
[2007-05-18 15:43:53 EST] <WorkerThread3> === Rollback Internal
Transaction
[2007-05-18 15:43:54 EST] <WorkerThread3> unable to find maximum
primary key value for WillowEntity
[2007-05-18 15:43:54 EST] <WorkerThread3>
com.webobjects.jdbcadaptor.JDBCAdaptorException:
EvaluateExpression failed: <com.webobjects.jdbcadaptor.MySQLPlugIn
$MySQLExpression: "SELECT MAX(id) FROM BinaryData">:
Next exception:SQL State:42S02 -- error code: 1146 -- msg:
Table 'willow_client.BinaryData' doesn't exist
I am not sure why this second select is happening, it seems wrong.
Perhaps the MySQL plugin does not "get" PK generation in this
situation?
Chuck
--
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:
40apple.com
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