Re: Locking unit test failure

From: Mike Kienenberger (mkienen..laska.net)
Date: Mon Feb 28 2005 - 14:48:02 EST


Andrus Adamchik <andru..bjectstyle.org> wrote:
> I am seeing this test failure in our nightly builds for a number of
> days:
>
> http://objectstyle.org/downloads/cayenne/nightly/2005-2-27/reports/org/
> objectstyle/cayenne/access/OptimisticLockingTst.html
>
> Nightly builds testing is done on Oracle 9i. This error doesn't happen
> on HSQLDB. I didn't have a chance to look it it closely. I assume this
> is something related to your recent checkins? Any ideas?

This particular test forces an optimistic lock failure on a delete.
For some reason, under Oracle, that exception isn't being thrown.

However, the SQL logging seems to indicate that it should be (following is
the last line).

DELETE FROM SIMPLE_LOCKING_TEST WHERE LOCKING_TEST_ID = ? AND NAME = ?
[batch bind: 1, 'LockTest1']
=== updated 0 rows.
+++ transaction committed.

Found the problem:

org.objectstyle.cayenne.dba.oracle.OracleDataNode only considers queries for
optimistic locking if it's an UpdateBatchQuery.

            boolean useOptimisticLock = (query instanceof UpdateBatchQuery)
                    && ((UpdateBatchQuery)
query).isUsingOptimisticLocking();

I could fix this one, but I'm starting to think that the proper fix is to
refactor isUsingOptimisticLocking() into BatchQuery, and just have
InsertBatchQuery always return false. DeleteBatchQuery already has
isUsingOptimisticLocking().



This archive was generated by hypermail 2.0.0 : Mon Feb 28 2005 - 14:47:16 EST