Re: Setting up horizontal inheritance
Re: Setting up horizontal inheritance
- Subject: Re: Setting up horizontal inheritance
- From: Lachlan Deck <email@hidden>
- Date: Wed, 5 Nov 2008 06:22:18 +1100
On 04/11/2008, at 6:57 PM, Paul Hoadley wrote:
On 04/11/2008, at 4:33 PM, Lachlan Deck wrote:
On 04/11/2008, at 9:12 AM, Chuck Hill wrote:
On Nov 2, 2008, at 10:30 PM, Paul Hoadley wrote:
On 03/11/2008, at 3:59 PM, Chuck Hill wrote:
[2008-11-3 16:53:8 CST] <WorkerThread2>
<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 = "Hoadley"; lastLogin
= 2008-11-03 06:23:08 Etc/GMT; id = 1; username = "super"; dob =
1973-06-07 14:30:00 Etc/GMT; password =
"hFG6ihTXl1PTTLM7UbpGtLAl64E="; firstName = "Paul"; lastPWChange
= 2007-11-12 13:30:00 Etc/GMT; }; _object = "PERSON: Paul
Hoadley"; _globalID = _EOIntegralKeyGlobalID[AMPerson
(java.lang.Integer)1]; _databaseOperator =
"EODatabaseUpdateOperator"; } does not contain value for
attribute named contactDetailsID with snapshot key:
contactDetailsID
So back up a bit in that error message:
_dbSnapshot = {};
That it is specifically complaining about contactDetailsID is is
red herring. The snapshot does not have values for any of the
attibutes, it is empty / missing.
If you're mapping the parent entity to a table in the db - you've
got VI rather than HI. I've never heard anyone mention before this
thread that for HI your parent entity needs to map to an external
table for pk generation. Again, if your parent entity has an
external table you're using VI.
Maybe I need to start again from scratch.
Several things can cause this. Some examples,. http://lists.apple.com/archives/webobjects-dev/2008/Apr/msg00458.html
Google for "_dbSnapshot = {};" for more.
IIRC, a bug with VI can also cause this. Lachlan may recall.
For VI your _changedValues will be {} for the parent entity - which
will give you a lock operation (with default EOF EODatabaseContext
anyway) - if the attributes for the parent entity have not been
changed prior to saveChanges.
Despite your comment above, I didn't think I was using VI. The
child entity's table contains all the columns of the parent.
That's just how they're modelled. At runtime, these resolve to the
parent entity if it has an external table (obviously as otherwise the
data wouldn't end up in the parent's db table). For true VI the
definition in the plist for an attribute will look something like this:
{
definition = "parentRelationship.created";
name = created;
prototypeName = timestamp;
},
You don't have a relationship from the child entity to the parent
though. So it's possible EOF is confused. Have you tried removing the
Table Name from the parent entity in the entity modeller?
So certainly no attributes for the parent have been changed,
The question is what attributes that are inherited from the parent
have been changed. That determines the answer to my question.
but only because they all have their own copies in the child. Am I
confusing EOF by having a table for the parent entity?
I would think so. The original documentation for inheritance [1] never
mentioned mapping the parent entity to a table as that would defeat
the whole purpose of HI (I would have thought). (Disclaimer: I've
never used HI).
[1] <http://developer.apple.com/documentation/WebObjects/UsingEOModeler/7ModelingInheritance/chapter_7_section_1.html#//apple_ref/doc/uid/TP30001018-CH207-TP1
>
This (pulled from the thread you've linked to is the common cause:
This is mostly commonly caused by not locking / improperly locking
EOEditingContext, EODatabaseContext, and probably a few of their
friends like EOObjectStoreCoordinator.
Or EOF got into a weird state. Is this happening on a relationship
e.g., from a child entity to another child entity?
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
I'm stumped. I'll start looking at the links suggested by Chuck.
It seems that the following methods in EODatabaseContext are returning
null (which causes an empty dictionary to be used as the dbSnapshot)
public NSDictionary snapshotForGlobalID(EOGlobalID gid)
public NSDictionary localSnapshotForGlobalID(EOGlobalID)
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