Re: vertical inheritance
Re: vertical inheritance
- Subject: Re: vertical inheritance
- From: Lachlan Deck <email@hidden>
- Date: Tue, 22 May 2007 13:21:46 +1000
On 22/05/2007, at 11:52 AM, Lachlan Deck wrote:
On 22/05/2007, at 11:28 AM, Lachlan Deck wrote:
[2007-05-22 11:26:02 EST] <WorkerThread12> === Begin Internal
Transaction
[2007-05-22 11:26:02 EST] <WorkerThread12> finding primary key
value for Person
[2007-05-22 11:26:02 EST] <WorkerThread12> evaluateExpression:
<com.webobjects.jdbcadaptor.MySQLPlugIn$MySQLExpression: "SELECT
PK FROM EO_PK_TABLE WHERE NAME = 'Person' FOR UPDATE">
[2007-05-22 11:26:02 EST] <WorkerThread12> fetch canceled
[2007-05-22 11:26:02 EST] <WorkerThread12> 1 row(s) processed
[2007-05-22 11:26:02 EST] <WorkerThread12> updating primary key
value for Person
[2007-05-22 11:26:02 EST] <WorkerThread12> evaluateExpression:
<com.webobjects.jdbcadaptor.MySQLPlugIn$MySQLExpression: "UPDATE
EO_PK_TABLE SET PK = 14 WHERE NAME = 'Person' AND PK = 13">
[2007-05-22 11:26:02 EST] <WorkerThread12> === Commit Internal
Transaction
[2007-05-22 11:26:02 EST] <WorkerThread12> === Begin Internal
Transaction
[2007-05-22 11:26:02 EST] <WorkerThread12> evaluateExpression:
<com.webobjects.jdbcadaptor.MySQLPlugIn$MySQLExpression: "INSERT
INTO Person(id, lastName, code, created, modified, firstName,
entityType) VALUES (?, ?, ?, ?, ?, ?, ?)" withBindings: 1:14
(NeededByEOF0), 2:"SaveMe"(lastName), 3:2(code), 4:2007-05-22
00:00:00(created), 5:2007-05-22 00:00:00(modified),
6:"Please"(firstName), 7:"Employee"(entityType)>
[2007-05-22 11:26:02 EST] <WorkerThread12> === Rollback Internal
Transaction
The message on screen says:
Could not save your changes:
Object value '2' for column 3 is not an instanceof String
Hmm, so when I enter the string '7777' it's trying to insert '2'...
why? That's sounds like it's trying to set the foreign key to
company on the wrong binding.
Okay, I've found one scenario that works without fail. This is most
definitely an EOF bug I'm submitting a bugreport now...
Work-a-round solution:
expose flattened foreign key in child as a class property. Now if I
set the relationship to a Company (either via the D2W assistance or
via awakeFromInsertion... setCompany) this now generates the correct
sql.
[2007-05-22 13:17:20 EST] <WorkerThread4> === Begin Internal
Transaction
[2007-05-22 13:17:20 EST] <WorkerThread4> finding primary key value
for Person
[2007-05-22 13:17:20 EST] <WorkerThread4> evaluateExpression:
<com.webobjects.jdbcadaptor.MySQLPlugIn$MySQLExpression: "SELECT PK
FROM EO_PK_TABLE WHERE NAME = 'Person' FOR UPDATE">
[2007-05-22 13:17:20 EST] <WorkerThread4> fetch canceled
[2007-05-22 13:17:20 EST] <WorkerThread4> 1 row(s) processed
[2007-05-22 13:17:20 EST] <WorkerThread4> updating primary key value
for Person
[2007-05-22 13:17:20 EST] <WorkerThread4> evaluateExpression:
<com.webobjects.jdbcadaptor.MySQLPlugIn$MySQLExpression: "UPDATE
EO_PK_TABLE SET PK = 27 WHERE NAME = 'Person' AND PK = 26">
[2007-05-22 13:17:20 EST] <WorkerThread4> === Commit Internal
Transaction
[2007-05-22 13:17:20 EST] <WorkerThread4> === Begin Internal
Transaction
[2007-05-22 13:17:20 EST] <WorkerThread4> evaluateExpression:
<com.webobjects.jdbcadaptor.MySQLPlugIn$MySQLExpression: "INSERT INTO
Person(id, lastName, code, firstName, companyId, modified, created,
entityType) VALUES (?, ?, ?, ?, ?, ?, ?, ?)" withBindings: 1:27
(NeededByEOF0), 2:"Bob"(lastName), 3:"777777"(code),
4:"Bill"(firstName), 5:2(companyId), 6:2007-05-22 00:00:00(modified),
7:2007-05-22 00:00:00(created), 8:"Employee"(entityType)>
[2007-05-22 13:17:20 EST] <WorkerThread4> evaluateExpression:
<com.webobjects.jdbcadaptor.MySQLPlugIn$MySQLExpression: "INSERT INTO
Employee(id) VALUES (?)" withBindings: 1:27(id)>
[2007-05-22 13:17:20 EST] <WorkerThread4> === Commit Internal
Transaction
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