I have another clue. Thanks for bearing with me.
On 04/11/2008, at 6:27 PM, Paul Hoadley wrote:
Maybe I need to start again from scratch.
Just to recap:
1. I have a framework that contains a model Auth that contains an entity Person. It also contains the UserPreference entity that has a to-one relationship to Person. Person is abstract.
2. I have an app that contains a model AMAuth that contains an entity AMPerson. I created AMPerson by subclassing Person in the Auth model (nominating HI), and then cut + pasting over the entries for AMPerson in index.eomodeld, and AMPerson.plist to the AMAuth model. I changed the package on the class appropriately. (Is there an easier way to generate a cross-model sub-entity?)
3. I have set up the tables using the SQL generated by Entity Modeler. This creates both 'person' and 'amperson', as well as 'person_seq' and 'amperson_seq'. The sequences get linked to their corresponding id columns to generate PKs. For the 'userpreference' table, I dropped the FK constraint to person.id.
4. I loaded the 'amperson' table with my set of test users.
No, its happening on an update to a timestamp column on the child. Worse, it's only happening the second time the app tries an update on that column. It's the lastLogin attribute. I can log in, and the column gets updated:
[2008-11-3 20:52:46 CST] <WorkerThread0> === Begin Internal Transaction
[2008-11-3 20:52:46 CST] <WorkerThread0> evaluateExpression: <com.webobjects.jdbcadaptor.PostgresqlExpression: "UPDATE amperson SET last_login = ?::timestamp WHERE id = ?::int4" withBindings: 1:2008-11-03 20:52:46.912(lastLogin), 2:3(id)>
[2008-11-3 20:52:46 CST] <WorkerThread0> === Commit Internal Transaction
Then if I log out, and back in:
[2008-11-3 20:53:3 CST] <WorkerThread1> === Begin Internal Transaction
[2008-11-3 20:53:3 CST] <WorkerThread1> evaluateExpression: <com.webobjects.jdbcadaptor.PostgresqlExpression: "UPDATE amperson SET last_login = ?::timestamp WHERE id = ?::int4" withBindings: 1:2008-11-03 20:53:03.434(lastLogin), 2:3(id)>
[2008-11-3 20:53:3 CST] <WorkerThread1> === Rollback Internal Transaction
[2008-11-3 20:53:3 CST] <WorkerThread1> <com.webobjects.appserver._private.WOComponentRequestHandler>: Exception occurred while handling request:
java.lang.IllegalStateException: rowDiffsForAttributes: snapshot in com.webobjects.eoaccess.EODatabaseOperation {_dbSnapshot = {}; _entity = "AMPerson"; _newRow = {lastName = "Turner"; lastLogin = 2008-11-03 10:23:03 Etc/GMT; id = 3; username = "admin"; dob = 1973-06-07 14:30:00 Etc/GMT; password = "0DPiKuNIrrVmD8IUCuw1hQxNqZc="; firstName = "Turnkey"; lastPWChange = 2007-11-12 13:30:00 Etc/GMT; }; _object = "PERSON: Turnkey Turner"; _globalID = _EOIntegralKeyGlobalID[AMPerson (java.lang.Integer)3]; _databaseOperator = "EODatabaseUpdateOperator"; } does not contain value for attribute named contactDetailsID with snapshot key: contactDetailsID
Application.handleException: Handling an Exception:
java.lang.IllegalStateException: rowDiffsForAttributes: snapshot in com.webobjects.eoaccess.EODatabaseOperation {_dbSnapshot = {}; _entity = "AMPerson"; _newRow = {lastName = "Turner"; lastLogin = 2008-11-03 10:23:03 Etc/GMT; id = 3; username = "admin"; dob = 1973-06-07 14:30:00 Etc/GMT; password = "0DPiKuNIrrVmD8IUCuw1hQxNqZc="; firstName = "Turnkey"; lastPWChange = 2007-11-12 13:30:00 Etc/GMT; }; _object = "PERSON: Turnkey Turner"; _globalID = _EOIntegralKeyGlobalID[AMPerson (java.lang.Integer)3]; _databaseOperator = "EODatabaseUpdateOperator"; } does not contain value for attribute named contactDetailsID with snapshot key: contactDetailsID
Moving around the app a little, I can generate a different exception:
java.lang.IllegalStateException: initializeObject: No snapshot for gid _EOIntegralKeyGlobalID[AMPerson (java.lang.Integer)4]
at com.webobjects.eoaccess.EODatabaseContext.initializeObject(EODatabaseContext.java:3578)
at com.webobjects.eocontrol.EOObjectStoreCoordinator.initializeObject(EOObjectStoreCoordinator.java:597)
at com.webobjects.eocontrol.EOEditingContext.initializeObject(EOEditingContext.java:3752)
at com.webobjects.eoaccess.EODatabaseChannel$_EODatabaseChannelFetchResult.initializeObjects(EODatabaseChannel.java:497)
at com.webobjects.eoaccess.EODatabaseContext._objectsWithFetchSpecificationEditingContext(EODatabaseContext.java:3090)
at com.webobjects.eoaccess.EODatabaseContext.objectsWithFetchSpecification(EODatabaseContext.java:3195)
at com.webobjects.eocontrol.EOObjectStoreCoordinator.objectsWithFetchSpecification(EOObjectStoreCoordinator.java:488)
at com.webobjects.eocontrol.EOEditingContext.objectsWithFetchSpecification(EOEditingContext.java:4053)
at com.webobjects.eocontrol.EOEditingContext.objectsWithFetchSpecification(EOEditingContext.java:4428)
at net.logicsquad.webobjects.auth.model.auth._Person.fetchPersons(_Person.java:351)
at net.logicsquad.webobjects.auth.model.auth.Person.fetchAllPersonsForOrganisationSorted(Person.java:213)
(Truncated.)
Person.fetchAllPersonsForOrganisationSorted() above is looking for the other Persons in the logged-in user's organisation. The AMPerson with PK=4 is the first such user in 'amperson', so presumably one of the sub-entities required is being found. What is causing this error?