Re: Update & Delete of an Enterprise Object causes EOEditingContext.saveChanges() to Exception
Re: Update & Delete of an Enterprise Object causes EOEditingContext.saveChanges() to Exception
- Subject: Re: Update & Delete of an Enterprise Object causes EOEditingContext.saveChanges() to Exception
- From: Chuck Hill <email@hidden>
- Date: Thu, 6 Nov 2008 09:48:22 -0800
On Nov 6, 2008, at 7:13 AM, Tim Kitchener wrote:
OS X 10.5.5
WebObjects 5.4.3
MySQL 5.1.26-rc - DB Storage Engine MyISAM
Java 1.5.0_16
I'm hoping that this is a fairly simple database/object model
inconsistency - I've spent an alarming amount of time scratching my
head, trying different things and trawling the 'net looking for a
solution so any assistance or advice you can provide will be more
than appreciated.
Any update or delete of any Enterprise Object in my model exceptions
when I call saveChages() on my EOEditingContext. Initially I
received a 'lock operation locked more than one row' exception - I
have checked that I've not got anything crazy going on like two rows
with the same primary key. Have tried taking taking optimistic
locking off of the object's attributes I now get a 'qualifier may
not be null' error.
Please help! Any suggestions as what could be causing this or tips
to troubleshoot this better are welcomed.
Sample Code to Recreate Exceptions:
{
Session session = (Session) session();
EOEditingContext ec = session.defaultEditingContext();
DbTest dbObj = (DbTest) EOUtilities.objectMatchingKeyAndValue (ec,
"Test", "priKey", 0);
dbObj.setFreeText("why does this not work - ARGH!");
ec.saveChanges(); /* This line throws the exception */
}
Console - With Optimistic Locking:
[2008-11-6 14:53:51 GMT] <WorkerThread0>
<com.webobjects.appserver._private.WOComponentRequestHandler>:
Exception occurred while handling request:
com.webobjects.eoaccess.EOGeneralAdaptorException:
lockRowComparingAttributes --
com.webobjects.jdbcadaptor.JDBCChannel: lock operation locked more
than one row
[2008-11-6 14:53:51 GMT] <WorkerThread0>
com.webobjects.eoaccess.EOGeneralAdaptorException:
lockRowComparingAttributes --
com.webobjects.jdbcadaptor.JDBCChannel: lock operation locked more
than one row
at
com
.webobjects
.eoaccess
.EODatabaseContext
._exceptionWithDatabaseContextInformationAdded
(EODatabaseContext.java:4504)
at
com
.webobjects
.eoaccess.EODatabaseContext.performChanges(EODatabaseContext.java:
6216)
at
com
.webobjects
.eocontrol
.EOObjectStoreCoordinator
.saveChangesInEditingContext(EOObjectStoreCoordinator.java:376)
at
com
.webobjects
.eocontrol.EOEditingContext.saveChanges(EOEditingContext.java:3192)
Console - Without Optimistic Locking:
[2008-11-6 14:52:2 GMT] <WorkerThread0>
<com.webobjects.appserver._private.WOComponentRequestHandler>:
Exception occurred while handling request:
com.webobjects.eoaccess.EOGeneralAdaptorException:
updateStatementForRow: qualifier may not be null
[2008-11-6 14:52:2 GMT] <WorkerThread0>
com.webobjects.eoaccess.EOGeneralAdaptorException:
updateStatementForRow: qualifier may not be null
at
com
.webobjects
.eoaccess
.EODatabaseContext
._exceptionWithDatabaseContextInformationAdded
(EODatabaseContext.java:4504)
at
com
.webobjects
.eoaccess.EODatabaseContext.performChanges(EODatabaseContext.java:
6216)
at
com
.webobjects
.eocontrol
.EOObjectStoreCoordinator
.saveChangesInEditingContext(EOObjectStoreCoordinator.java:376)
at
com
.webobjects
.eocontrol.EOEditingContext.saveChanges(EOEditingContext.java:3192)
Thanks and kindest regards,
In addition to the other suggestions, the fact that it is trying to
lock at _all_ is a big red flag. EOF does not lock rows (unless you
force it to or make it crazy), it uses a WHERE clause on the UPDATE
statement.
1. is the jdbc2info in the connection dictionary for another
database / driver / version? If so, delete it and try again.
2. Check the value type and external type in the EOModel /
EOPrototypes to see ensure they are correct. The external types may be
case sensitive.
Chuck
--
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