Re: EOF Inheritance problems help
Re: EOF Inheritance problems help
- Subject: Re: EOF Inheritance problems help
- From: Lachlan Deck <email@hidden>
- Date: Fri, 18 May 2007 21:59:31 +1000
Hi there,
On 18/05/2007, at 8:25 PM, Ken Anderson wrote:
Maybe others could chime in more, but one thing I know is that EOF
will use the top entity in the hierarchy to get the primary key so
that all sub-entities have unique keys.
That part I have no problem with. The primary key is being correctly
created in both super and sub-entities.
This is pretty necessary if you're going to have a relationship to
the super-entity (otherwise, the foreign key would not be unique).
You could always handle primary key generation yourself and handle
your situation...
The problem I'm having is that when the sub-entity is being saved to
the database, the foreign key to a 3rd entity (i.e., a relationship
defined in the super entity to another entity) is not being generated
in the super-entity.
Any ideas on that?
On May 18, 2007, at 2:21 AM, 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?
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)
with regards,
--
Lachlan Deck
2007-05-18 15:43:53,837 [WorkerThread3 ] DEBUG
com.ish.willow.soap.webservices.controllers.SOAPController -
updateRecordsForEntity Course save ec...0
2007-05-18 15:43:53,837 [WorkerThread3 ] DEBUG
com.ish.willow.soap.webservices.controllers.SOAPController -
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2007-05-18 15:43:53,837 [WorkerThread3 ] DEBUG
com.ish.willow.soap.webservices.controllers.SOAPController -
Label:Snapshot for Child Editing Context
2007-05-18 15:43:53,838 [WorkerThread3 ] DEBUG
com.ish.willow.soap.webservices.controllers.SOAPController -
-----------------------------
2007-05-18 15:43:53,838 [WorkerThread3 ] DEBUG
com.ish.willow.soap.webservices.controllers.SOAPController -
Inserted objects:
2007-05-18 15:43:53,845 [WorkerThread3 ] DEBUG
com.ish.willow.soap.webservices.controllers.SOAPController -
snapshot:{<....>; client = <java.lang.Class(cec78d) Fault
_EOIntegralKeyGlobalID[Client (java.lang.Long)1]>;
binaryInfoRelations = (); angelId = 215; entityType = "Course"; }
2007-05-18 15:43:53,846 [WorkerThread3 ] DEBUG
com.ish.willow.soap.webservices.controllers.SOAPController -
Updated objects:
2007-05-18 15:43:53,846 [WorkerThread3 ] DEBUG
com.ish.willow.soap.webservices.controllers.SOAPController -
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
2007-05-18 15:43:53,936 [WorkerThread3 ] DEBUG
com.ish.willow.soap.webservices.controllers.SOAPController -
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2007-05-18 15:43:53,936 [WorkerThread3 ] DEBUG
com.ish.willow.soap.webservices.controllers.SOAPController -
Label:Snapshot for Parent Editing Context
2007-05-18 15:43:53,936 [WorkerThread3 ] DEBUG
com.ish.willow.soap.webservices.controllers.SOAPController -
-----------------------------
2007-05-18 15:43:53,937 [WorkerThread3 ] DEBUG
com.ish.willow.soap.webservices.controllers.SOAPController -
Inserted objects:
2007-05-18 15:43:53,937 [WorkerThread3 ] DEBUG
com.ish.willow.soap.webservices.controllers.SOAPController -
Updated objects:
2007-05-18 15:43:53,937 [WorkerThread3 ] DEBUG
com.ish.willow.soap.webservices.controllers.SOAPController -
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
[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
[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
at
com.webobjects.jdbcadaptor.JDBCContext._jdbcErrorWithChannel
(JDBCContext.java:138)
at
com.webobjects.jdbcadaptor.JDBCChannel._evaluateExpression
(JDBCChannel.java:310)
at
com.webobjects.jdbcadaptor.JDBCChannel.evaluateExpression
(JDBCChannel.java:261)
at com.webobjects.jdbcadaptor.JDBCPlugIn.newPrimaryKeys
(JDBCPlugIn.java:687)
at
com.webobjects.jdbcadaptor.JDBCChannel.primaryKeysForNewRowsWithEntit
y(JDBCChannel.java:537)
at
com.webobjects.eoaccess.EODatabaseContext._batchNewPrimaryKeysWithEnt
ity(EODatabaseContext.java:5891)
at
com.webobjects.eoaccess.EODatabaseContext.prepareForSaveWithCoordinat
or(EODatabaseContext.java:5874)
at
com.webobjects.eocontrol.EOObjectStoreCoordinator.saveChangesInEditin
gContext(EOObjectStoreCoordinator.java:409)
at com.webobjects.eocontrol.EOEditingContext.saveChanges
(EOEditingContext.java:3165)
at
com.ish.willow.soap.webservices.controllers.SOAPController.updateReco
rdsForEntity(SOAPController.java:320)
at
au.com.ish.oncourseservices.v2.services.AngelReplicator.replicateReco
rds(AngelReplicator.java:73)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.axis.providers.java.RPCProvider.invokeMethod
(RPCProvider.java:372)
at
org.apache.axis.providers.java.RPCProvider.processMessage
(RPCProvider.java:292)
at org.apache.axis.providers.java.JavaProvider.invoke
(JavaProvider.java:276)
at org.apache.axis.strategies.InvocationStrategy.visit
(InvocationStrategy.java:71)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:
156)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:126)
at org.apache.axis.handlers.soap.SOAPService.invoke
(SOAPService.java:437)
at org.apache.axis.server.AxisServer.invoke
(AxisServer.java:316)
at
com.webobjects.appserver._private.WOWebService.performActionNamed
(WOWebService.java:364)
at
com.webobjects.appserver._private.WOActionRequestHandler._handleReque
st(WOActionRequestHandler.java:240)
at
com.webobjects.appserver._private.WOActionRequestHandler.handleReques
t(WOActionRequestHandler.java:142)
at
com.webobjects.appserver._private.WOWebServiceRequestHandler.handleRe
quest(WOWebServiceRequestHandler.java:88)
at
com.ish.willow.soap.appserver.ISHWebServiceRequestHandler.handleReque
st(ISHWebServiceRequestHandler.java:87)
at com.webobjects.appserver.WOApplication.dispatchRequest
(WOApplication.java:1306)
at
com.ish.webobjects.appserver.ISHApplication.dispatchRequest
(ISHApplication.java:912)
at
com.ish.willow.soap.appserver.Application.dispatchRequest
(Application.java:115)
at com.webobjects.appserver._private.WOWorkerThread.runOnce
(WOWorkerThread.java:173)
at com.webobjects.appserver._private.WOWorkerThread.run
(WOWorkerThread.java:254)
at java.lang.Thread.run(Thread.java:534)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40anderhome.com
This email sent to email@hidden
with regards,
--
Lachlan Deck
_______________________________________________
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