Just as a hint:
I remember having problems with naming a column oid in PostgreSQL. So,
if you want to be database agnostic, use id or something like
person_id or so.
cug
On 06.11.2008, at 10:39, Kieran Kelleher wrote:
Hi Tim,
[Keep the discussion on the list, I hate to monopolize a discussion
especially when there are so many friendly and non-cranky developers
willing to help on the list ... ;-)]
Maybe you have not setup your eomodel correctly? The PK should be
identified as such...... and it should have the little "lock" on.
See pic below.....
<example-1.jpg>
On Nov 6, 2008, at 12:17 PM, Tim Kitchener wrote:
Kieran,
Thank you for the warnings!
I'm now using MySQL 5.0.67 and my tables are stored using InnoDB -
I have recreated my test table to ensure that the primary key has
been created correctly - the ec.saveChanges line still exceptions,
however it is now only the Qualifier cannot be null exception
regardless of whether optimistic locking is on or not in the EO
model.
I'm using mysql-connector-java-5.0.8-bin.
Any further suggestions?
-- Tim
On 6 Nov 2008, at 15:46, Kieran Kelleher wrote:
**RED FLAG**
Never ever use MyIsam as an engine for WebObjects if you want to
maintain data integrity. MyIsam is not a transaction engine. In a
nutshell, an editing context that fails during saving cannot roll
back the transaction and thus you are left with have updated stuff
in the database, orphan relationships and all kinds of roadmines
for you to blow up in future database activity.
Use the InnoDB engine that comes with MySQL. Set it as default in /
etc/my.cnf and ALTER existing tables to have the ENGINE=innodb
parameter.
I use MyISAM in one case only, for speed advantage .... for a
simple database with a few **READONLY** lookup tables containing
100 million rows in largest table.
Now I would guess that your error is caused by your database
table's primary key setup being incorrect somehow..... jump into
mysql command line and do a SHOW CREATE TABLE tablename; to see
table def. There should be a primary key defined ..... for example
here is a table (innodb BTW) with a PK defined in the normal way:
SHOW CREATE TABLE taxrate;
CREATE TABLE `taxrate` (
`descriptor` varchar(255) NOT NULL,
`oid` int(11) NOT NULL,
`taxpercentage` decimal(18,7) NOT NULL,
PRIMARY KEY (`oid`)
) ENGINE=InnoDB;
Also, BTW, I use MySQL 4.1.21 thru 5.0.67. I don't waste my time
with higher version release candidates .... WebObjects uses basic
ANSI SQL 92 features in general and is not using mysql specific
bells and whistles, so 5.0.XX latest is reliable if you can use
that. Also, I use the mysql-connector-java-5.0.7-bin.jar for JDBC
with all above mysql versions.
HTH, Kieran
On Nov 6, 2008, at 10: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,
-- a frustrated Tim
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/kieran_lists%40mac.com
This email sent to [EMAIL PROTECTED]
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/guido.neitzer%40gmail.com
This email sent to [EMAIL PROTECTED]
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [EMAIL PROTECTED]