• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Setting up horizontal inheritance
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Setting up horizontal inheritance


  • Subject: Re: Setting up horizontal inheritance
  • From: Chuck Hill <email@hidden>
  • Date: Tue, 4 Nov 2008 14:16:58 -0800

Just a thought... Are you using Wonder to set the connection dictionaries for both models? If the connection dictionaries are not _identical_ (and I do mean indentical), that will cause problems. Perhaps this one. Mike added something to Wonder, I think, to warn or throw if this happens. I think...


Chuck


On Nov 4, 2008, at 2:08 PM, Paul Hoadley wrote:

On 05/11/2008, at 8:21 AM, Chuck Hill wrote:

On Nov 4, 2008, at 1:42 PM, Paul Hoadley wrote:
On 05/11/2008, at 5:25 AM, Chuck Hill wrote:
On Nov 4, 2008, at 1:50 AM, Paul Hoadley wrote:

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.

How are you doing that, exactly?

With raw SQL and psql. Outside of EOF. So after inserting 6 test users, amperson_seq is sitting at last_value = 6, and person_seq is sitting at last_value = 1. Is this the problem? If the PKs need to be unique across all sub-entities, should the tables be using a common sequence?

EOF will only use person_seq. That is going to be a problem if you create any new objects. When you insert into amperson, you MUST use the person_seq sequence. That said, it does not sound like the cause of your current WOe. It will be the cause of your next one... :-)

Great.

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 am still very unsure as to what is happening. Have you checked to ensure that you are locking the ECs correctly if you are not using the session's defaultEditingContext, ERXEC etc.?

Originally, the code generating the error above was using the defaultEditingContext. I then changed it to use ERXEC and got the exact same problem. (The entire app worked fine before this effort to move a model into an external framework and subclass Person, though there may have been latent problems that this has exposed.)



-- Paul.

w  http://logicsquad.net/
h  http://paul.hoadley.name/




-- Chuck Hill Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects







_______________________________________________ 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
  • Follow-Ups:
    • Re: Setting up horizontal inheritance
      • From: Paul Hoadley <email@hidden>
    • Re: Setting up horizontal inheritance
      • From: Mike Schrag <email@hidden>
References: 
 >Re: Setting up horizontal inheritance (From: Chuck Hill <email@hidden>)
 >Re: Setting up horizontal inheritance (From: Paul Hoadley <email@hidden>)
 >Re: Setting up horizontal inheritance (From: Ken Anderson <email@hidden>)
 >Re: Setting up horizontal inheritance (From: Paul Hoadley <email@hidden>)
 >Re: Setting up horizontal inheritance (From: Chuck Hill <email@hidden>)
 >Re: Setting up horizontal inheritance (From: Paul Hoadley <email@hidden>)
 >Re: Setting up horizontal inheritance (From: Chuck Hill <email@hidden>)
 >Re: Setting up horizontal inheritance (From: Lachlan Deck <email@hidden>)
 >Re: Setting up horizontal inheritance (From: Paul Hoadley <email@hidden>)
 >Re: Setting up horizontal inheritance (From: Paul Hoadley <email@hidden>)
 >Re: Setting up horizontal inheritance (From: Chuck Hill <email@hidden>)
 >Re: Setting up horizontal inheritance (From: Paul Hoadley <email@hidden>)
 >Re: Setting up horizontal inheritance (From: Chuck Hill <email@hidden>)
 >Re: Setting up horizontal inheritance (From: Paul Hoadley <email@hidden>)

  • Prev by Date: Re: Setting up horizontal inheritance
  • Next by Date: Re: Setting up horizontal inheritance
  • Previous by thread: Re: Setting up horizontal inheritance
  • Next by thread: Re: Setting up horizontal inheritance
  • Index(es):
    • Date
    • Thread