Hi, All
I know this is old topic, but I found something this time when try to play this 
"vertical inheritance" with Apple/example/SophisticatedDatabaseExample
Copied from README:
The SophisticatedDatabaseExample demonstrates the use of inheritance, 
flattening, and multiple models.
 The Person class is abstract. Student, Parent and Employee inherit from Person 
using horizontal inheritance.
 The Admin,Staff, Teacher classes all inherit from Employee using single-table 
inheritance.
 The HomeAddress, WorkAddress, and BillingAddress inherit from Address using 
vertical inheritance. 
I turn on the log, because the application is working randomly.Attached is 
working and not working part log file. 
When it's working,EOF generated the  the right sequence table name for insert 
sql like address, home_addres then student.
When it's not working, EOF generated sql is wrong sequence , try to insert 
STUDENT first and broken, because no address and home_address in database.
I found there was a bug fixed report in WO5.4.1, No 5405227 , "Vertical 
inheritance does not generate the right sequence table name",
I am using WO 5.4.3, but not WOnder. Not sure this is the new bug, or not fixed 
totally, 
Is any workaround solution? Or fix in WO , Wonder later? 
Is it an "INITIALLY DEFERRED DEFERRABLE"constraints issue in MySQL?but it's 
working sometimes. 


Thanks 
<<saveChanges.txt>>  
kevin


      
==saveChanges =====insertedObjects: ( {values = {zip = "6001"; state = "WG"; 
street = "4 Hunter street"; addressType = 1; emailAddress = "[email protected]"; 
city = "Wellington"; phone = <com.webobjects.foundation.NSKeyValueCoding$Null>; 
}; this = "<school.eo.HomeAddress fdb00d <EOTemporaryGlobalID: 0 0 127 0 0 1 0 
0 11 -71 4 0 0 0 1 37 -98 82 56 -62 90 -18 -42 -124>>"; },
{values = {lastName = "Lee"; status = 
<com.webobjects.foundation.NSKeyValueCoding$Null>; address = 
"<school.eo.HomeAddress fdb00d <EOTemporaryGlobalID: 0 0 127 0 0 1 0 0 11 -71 4 
0 0 0 1 37 -98 82 56 -62 90 -18 -42 -124>>"; scheduledClasses = (  ); firstName 
= "james"; login = "james"; dateOfBirth = 2000-12-31 11:00:00 Etc/GMT; password 
= "james"; parents = (  ); age = 
<com.webobjects.foundation.NSKeyValueCoding$Null>; }; this = 
"<school.eo.Student 3cc262 <EOTemporaryGlobalID: 0 0 127 0 0 1 0 0 11 -71 3 0 0 
0 1 37 -98 82 56 -62 90 -18 -42 -124>>"; } )
==saveChanges =====updateObjects: (  )
==saveChanges =====deleteObjects: (  )
[2009-12-18 9:31:25 NZDT] <WorkerThread12>  === Begin Internal Transaction
[2009-12-18 9:31:25 NZDT] <WorkerThread12> Searching for primary key value for 
ADDRESS
[2009-12-18 9:31:25 NZDT] <WorkerThread12>  evaluateExpression: 
<com.webobjects.jdbcadaptor.MySQLPlugIn$MySQLExpression: "SELECT PK FROM 
EO_PK_TABLE WHERE NAME = 'ADDRESS' FOR UPDATE" withBindings: >
[2009-12-18 9:31:25 NZDT] <WorkerThread12> fetch canceled
[2009-12-18 9:31:25 NZDT] <WorkerThread12> 1 row(s) processed
[2009-12-18 9:31:25 NZDT] <WorkerThread12> Updating primary key value for 
ADDRESS in PK table named: EO_PK_TABLE to seed value: 29
[2009-12-18 9:31:25 NZDT] <WorkerThread12>  evaluateExpression: 
<com.webobjects.jdbcadaptor.MySQLPlugIn$MySQLExpression: "UPDATE EO_PK_TABLE 
SET PK = 29 WHERE NAME = 'ADDRESS' AND PK = 28" withBindings: >
[2009-12-18 9:31:25 NZDT] <WorkerThread12>  === Commit Internal Transaction
[2009-12-18 9:31:25 NZDT] <WorkerThread12>  === Begin Internal Transaction
[2009-12-18 9:31:25 NZDT] <WorkerThread12> Searching for primary key value for 
Person
[2009-12-18 9:31:25 NZDT] <WorkerThread12>  evaluateExpression: 
<com.webobjects.jdbcadaptor.MySQLPlugIn$MySQLExpression: "SELECT PK FROM 
EO_PK_TABLE WHERE NAME = 'Person' FOR UPDATE" withBindings: >
[2009-12-18 9:31:25 NZDT] <WorkerThread12> fetch canceled
[2009-12-18 9:31:25 NZDT] <WorkerThread12> 1 row(s) processed
[2009-12-18 9:31:25 NZDT] <WorkerThread12> Updating primary key value for 
Person in PK table named: EO_PK_TABLE to seed value: 94
[2009-12-18 9:31:25 NZDT] <WorkerThread12>  evaluateExpression: 
<com.webobjects.jdbcadaptor.MySQLPlugIn$MySQLExpression: "UPDATE EO_PK_TABLE 
SET PK = 94 WHERE NAME = 'Person' AND PK = 93" withBindings: >
[2009-12-18 9:31:25 NZDT] <WorkerThread12>  === Commit Internal Transaction
[2009-12-18 9:31:25 NZDT] <WorkerThread12>  === Begin Internal Transaction
[2009-12-18 9:31:25 NZDT] <WorkerThread12>  evaluateExpression: 
<com.webobjects.jdbcadaptor.MySQLPlugIn$MySQLExpression: "INSERT INTO 
ADDRESS(ADDRESS_ID, STATE, STREET, ADDRESS_TYPE, CITY, PHONE, ZIP) VALUES (?, 
?, ?, ?, ?, NULL, ?)" withBindings: 1:29(NeededByEOF0), 2:"WG"(state), 3:"4 
Hunter street"(street), 4:1(addressType), 5:"Wellington"(city), 6:"6001"(zip)>
[2009-12-18 9:31:25 NZDT] <WorkerThread12>  evaluateExpression: 
<com.webobjects.jdbcadaptor.MySQLPlugIn$MySQLExpression: "INSERT INTO 
HOME_ADDRESS(EMAIL_ADDRESS, ADDRESS_ID) VALUES (?, ?)" withBindings: 
1:"[email protected]"(emailAddress), 2:29(addressID)>
[2009-12-18 9:31:25 NZDT] <WorkerThread12>  evaluateExpression: 
<com.webobjects.jdbcadaptor.MySQLPlugIn$MySQLExpression: "INSERT INTO 
STUDENT(PERSON_ID, LAST_NAME, STATUS, ADDRESS_ID, PASSWORD, LOGIN, 
DATE_OF_BIRTH, FIRST_NAME, AGE) VALUES (?, ?, NULL, ?, ?, ?, ?, ?, NULL)" 
withBindings: 1:94(personID), 2:"Lee"(lastName), 3:29(addressID), 
4:"james"(password), 5:"james"(login), 6:2001-01-01 00:00:00(dateOfBirth), 
7:"james"(firstName)>
[2009-12-18 9:31:25 NZDT] <WorkerThread12>  === Commit Internal Transaction


Next is the not working log:

==saveChanges =====insertedObjects: ( {values = {lastName = "ren"; status = 
<com.webobjects.foundation.NSKeyValueCoding$Null>; address = 
"<school.eo.HomeAddress 1976011 <EOTemporaryGlobalID: 0 0 127 0 0 1 0 0 11 -71 
2 0 0 0 1 37 -98 111 109 113 4 -104 -10 85>>"; scheduledClasses = (  ); 
firstName = "xiao"; login = "xiao"; dateOfBirth = 1973-03-05 12:00:00 Etc/GMT; 
password = "xiao"; parents = (  ); age = 
<com.webobjects.foundation.NSKeyValueCoding$Null>; }; this = 
"<school.eo.Student 1bb5c09 <EOTemporaryGlobalID: 0 0 127 0 0 1 0 0 11 -71 1 0 
0 0 1 37 -98 111 109 113 4 -104 -10 85>>"; },
{values = {zip = "5555"; state = "WG"; street = "2  Hunter street"; addressType 
= 1; emailAddress = "[email protected]"; city = "wellington"; phone = 
<com.webobjects.foundation.NSKeyValueCoding$Null>; }; this = 
"<school.eo.HomeAddress 1976011 <EOTemporaryGlobalID: 0 0 127 0 0 1 0 0 11 -71 
2 0 0 0 1 37 -98 111 109 113 4 -104 -10 85>>"; } )
==saveChanges =====updateObjects: (  )
==saveChanges =====deleteObjects: (  )
[2009-12-18 9:59:21 NZDT] <WorkerThread13>  === Begin Internal Transaction
[2009-12-18 9:59:21 NZDT] <WorkerThread13> Searching for primary key value for 
ADDRESS
[2009-12-18 9:59:21 NZDT] <WorkerThread13>  evaluateExpression: 
<com.webobjects.jdbcadaptor.MySQLPlugIn$MySQLExpression: "SELECT PK FROM 
EO_PK_TABLE WHERE NAME = 'ADDRESS' FOR UPDATE" withBindings: >
[2009-12-18 9:59:21 NZDT] <WorkerThread13> fetch canceled
[2009-12-18 9:59:21 NZDT] <WorkerThread13> 1 row(s) processed
[2009-12-18 9:59:21 NZDT] <WorkerThread13> Updating primary key value for 
ADDRESS in PK table named: EO_PK_TABLE to seed value: 33
[2009-12-18 9:59:21 NZDT] <WorkerThread13>  evaluateExpression: 
<com.webobjects.jdbcadaptor.MySQLPlugIn$MySQLExpression: "UPDATE EO_PK_TABLE 
SET PK = 33 WHERE NAME = 'ADDRESS' AND PK = 32" withBindings: >
[2009-12-18 9:59:21 NZDT] <WorkerThread13>  === Commit Internal Transaction
[2009-12-18 9:59:21 NZDT] <WorkerThread13>  === Begin Internal Transaction
[2009-12-18 9:59:21 NZDT] <WorkerThread13> Searching for primary key value for 
Person
[2009-12-18 9:59:21 NZDT] <WorkerThread13>  evaluateExpression: 
<com.webobjects.jdbcadaptor.MySQLPlugIn$MySQLExpression: "SELECT PK FROM 
EO_PK_TABLE WHERE NAME = 'Person' FOR UPDATE" withBindings: >
[2009-12-18 9:59:21 NZDT] <WorkerThread13> fetch canceled
[2009-12-18 9:59:21 NZDT] <WorkerThread13> 1 row(s) processed
[2009-12-18 9:59:21 NZDT] <WorkerThread13> Updating primary key value for 
Person in PK table named: EO_PK_TABLE to seed value: 98
[2009-12-18 9:59:21 NZDT] <WorkerThread13>  evaluateExpression: 
<com.webobjects.jdbcadaptor.MySQLPlugIn$MySQLExpression: "UPDATE EO_PK_TABLE 
SET PK = 98 WHERE NAME = 'Person' AND PK = 97" withBindings: >
[2009-12-18 9:59:21 NZDT] <WorkerThread13>  === Commit Internal Transaction
[2009-12-18 9:59:21 NZDT] <WorkerThread13>  === Begin Internal Transaction
[2009-12-18 9:59:21 NZDT] <WorkerThread13>  evaluateExpression: 
<com.webobjects.jdbcadaptor.MySQLPlugIn$MySQLExpression: "INSERT INTO 
STUDENT(PERSON_ID, LAST_NAME, STATUS, ADDRESS_ID, PASSWORD, LOGIN, 
DATE_OF_BIRTH, FIRST_NAME, AGE) VALUES (?, ?, NULL, ?, ?, ?, ?, ?, NULL)" 
withBindings: 1:98(personID), 2:"ren"(lastName), 3:33(addressID), 
4:"xiao"(password), 5:"xiao"(login), 6:1973-03-06 00:00:00(dateOfBirth), 
7:"xiao"(firstName)>
[2009-12-18 9:59:21 NZDT] <WorkerThread13>  === Rollback Internal Transaction
[2009-12-18 9:59:21 NZDT] <WorkerThread13> 
<com.webobjects.appserver._private.WOComponentRequestHandler>: Exception 
occurred while handling request:
com.webobjects.eoaccess.EOGeneralAdaptorException: EvaluateExpression failed: 
<com.webobjects.jdbcadaptor.MySQLPlugIn$MySQLExpression: "INSERT INTO 
STUDENT(PERSON_ID, LAST_NAME, STATUS, ADDRESS_ID, PASSWORD, LOGIN, 
DATE_OF_BIRTH, FIRST_NAME, AGE) VALUES (?, ?, NULL, ?, ?, ?, ?, ?, NULL)" 
withBindings: 1:98(personID), 2:"ren"(lastName), 3:33(addressID), 
4:"xiao"(password), 5:"xiao"(login), 6:1973-03-06 00:00:00(dateOfBirth), 
7:"xiao"(firstName)>:
    Next exception:SQL State:23000 -- error code: 1452 -- msg: Cannot add or 
update a child row: a foreign key constraint fails (`school`.`STUDENT`, 
CONSTRAINT `STUDENT_ibfk_1` FOREIGN KEY (`ADDRESS_ID`) REFERENCES `ADDRESS` 
(`ADDRESS_ID`))


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to