• 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
lockRowComparingAttributes (yet again)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

lockRowComparingAttributes (yet again)


  • Subject: lockRowComparingAttributes (yet again)
  • From: Ian Joyner <email@hidden>
  • Date: Thu, 4 Aug 2005 17:48:59 +1000

OK, I have read all the past mails on this issue trying to solve this problem. I have a person entity where generic person attributes are stored in a PERSON table and specific attributes are stored in a subclass table (called ASSET). I create and store one of these entities, then add a telephone number for them (stored in a separate TELEPHONE table). The SQL generated for the original save is:

[2005-08-04 17:13:03 EST] <WorkerThread1>  evaluateExpression: <com.webobjects.jdbcadaptor.OpenBasePlugIn$OpenBaseExpression: "INSERT INTO PERSON(PRIMARY_KEY, GENDER_KEY, PERSON_TYPE_KEY, DATE_OF_BIRTH, TERMINATION_DATE, UNIQUE_ID, CREATION_DATE, ALIAS, MODIFICATION_DATE, TYPE, TITLE_KEY, FIRST_NAME, SURNAME, MIDDLE_NAMES) VALUES (?, ?, ?, NULL, NULL, NULL, ?, NULL, ?, ?, ?, ?, ?, NULL)" withBindings: 1:4(NeededByEOF0), 2:6.0(gender_key), 3:12.0(person_type_key), 4:2005-08-04 17:13:03(creation_date), 5:2005-08-04 17:13:03(modification_date), 6:"A"(type), 7:1.0(title_key), 8:"tyu"(first_name), 9:"tyu"(surname)>


[2005-08-04 17:13:03 EST] <WorkerThread1>  evaluateExpression: <com.webobjects.jdbcadaptor.OpenBasePlugIn$OpenBaseExpression: "INSERT INTO ASSET(HEALTH_FUND_NUMBER, PRIMARY_KEY, HEALTH_FUND_EXPIRY_DATE, PLAYER_NUMBER, HEALTH_FUND, ASSET_TYPE_KEY, MEDICAL_EXPIRY_DATE, MEMBER_ID, IS_A_DOCTOR, CLUB, MEDICAL_NUMBER, IS_A_MANAGER) VALUES (NULL, ?, NULL, NULL, NULL, ?, NULL, NULL, NULL, NULL, NULL, NULL)" withBindings: 1:4(primary_key), 2:13.0(asset_type_key)>

When I attempt to save the new telephone record, I get:

[2005-08-04 17:13:24 EST] <WorkerThread3>  evaluateExpression: <com.webobjects.jdbcadaptor.OpenBasePlugIn$OpenBaseExpression: "SELECT t0.PRIMARY_KEY FROM ASSET t0, PERSON T1 FOR UPDATE WHERE (T1.TYPE = ? AND (t0.PRIMARY_KEY = ? AND t0.MEMBER_ID is NULL AND t0.ASSET_TYPE_KEY = ? AND t0.PLAYER_NUMBER is NULL AND t0.CLUB is NULL AND t0.MEDICAL_NUMBER is NULL AND t0.MEDICAL_EXPIRY_DATE is NULL AND t0.HEALTH_FUND is NULL AND t0.HEALTH_FUND_NUMBER is NULL AND t0.HEALTH_FUND_EXPIRY_DATE is NULL AND t0.IS_A_DOCTOR is NULL AND t0.IS_A_MANAGER is NULL)) AND t0.PRIMARY_KEY = T1.PRIMARY_KEY" withBindings: 1:"A"(type), 2:4(primary_key), 3:13.0(asset_type_key)>
[2005-08-04 17:13:24 EST] <WorkerThread3> 1 row(s) processed
[2005-08-04 17:13:24 EST] <WorkerThread3>  === Rollback Internal Transaction
[2005-08-04 17:13:24 EST] <WorkerThread3> Server exception: lockRowComparingAttributes -- com.webobjects.jdbcadaptor.JDBCChannel: lock operation fetched row with different values than snapshot
[2005-08-04 17:13:24 EST] <WorkerThread3> com.webobjects.eoaccess.EOGeneralAdaptorException: lockRowComparingAttributes -- com.webobjects.jdbcadaptor.JDBCChannel: lock operation fetched row with different values than snapshot
    at com.webobjects.eoaccess.EODatabaseContext._exceptionWithDatabaseContextInformationAdded(EODatabaseContext.java:4686)
    at com.webobjects.eoaccess.EODatabaseContext.performChanges(EODatabaseContext.java:6394)
    at com.webobjects.eocontrol.EOObjectStoreCoordinator.saveChangesInEditingContext(EOObjectStoreCoordinator.java:415)

lockRowComparingAttributes has found a single record, so that is OK, but it must fail on the comparison.
Now I have also turned off attribute locking on every attribute, so that lockRowComparingAttributes only retrieves the bare minimum:     

SELECT t0.PRIMARY_KEY FROM 
ASSET t0, 
PERSON T1 FOR UPDATE 
WHERE (T1.TYPE = ? AND (t0.PRIMARY_KEY = ? AND t0.ASSET_TYPE_KEY = ?)) AND t0.PRIMARY_KEY = T1.PRIMARY_KEY" withBindings: 1:"A"(type), 2:49(primary_key), 3:13.0(asset_type_key)

and this still fails.

Is there a problem with optimistic locking and inheritance? Any other factor that might be causing this, because I think I have tried every other suggestion from past posts.

Thanks
Ian Joyner
Sportstec

 _______________________________________________
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: lockRowComparingAttributes (yet again)
      • From: Chuck Hill <email@hidden>
  • Prev by Date: Installing Project Wonder
  • Next by Date: Re: Installing Project Wonder
  • Previous by thread: Re: Installing Project Wonder
  • Next by thread: Re: lockRowComparingAttributes (yet again)
  • Index(es):
    • Date
    • Thread