RE: Optimistic Locking Bug?

From: Gentry, Michael \(Contractor\) ("Gentry,)
Date: Tue May 10 2005 - 15:59:18 EDT

  • Next message: Mike Kienenberger: "Re: Safe to compare testmap.xml + cgen with src/tests/java/org/objectstyle.art.auto?"

    Well, I'm using Cayenne 1.1 with a customized DB Adapter (subclassed from the Sybase Adapter -- mine adds binary PK support for our DB which should only be hit on an INSERT).

    I'll look at the createSqlString/etc methods, but it might not get done today (leaving early for once -- I hope). Who knows, maybe I can find out down in there why it insists on updating rows that haven't changed (when I do a commitChanges(), it always updates rows that haven't changed by setting their PK back to the original value).

    I swear it's the binary PKs ...

    Thanks,

    /dev/mrg

    -----Original Message-----
    From: Mike Kienenberger [mailto:mkienen..laska.net]
    Sent: Tuesday, May 10, 2005 3:45 PM
    To: cayenne-deve..bjectstyle.org
    Subject: Re: Optimistic Locking Bug?

    "Michael Gentry (Yes, I'm a Contractor)" <michael_gentr..anniemae.com>
    wrote:
    >
    > Iım getting an optimistic locking failure when trying to update a record.
    > Here is a portion of the log with the problem highlighted (and reformatted
    > to be easier to read, hopefully):
    >
    > 14:26:55,115 INFO QueryLogger:315 -
    > UPDATE LoanCommitment
    > SET identifier = ?,
    > commitmentOpenState = ?
    > WHERE identifier = ? AND
    > comments IS NULL AND
    > commitmentOpenState = ? AND
    > commitmentPeriod = ?
    > AND createDate = ? ...
    >
    > 14:26:55,196 INFO QueryLogger:337 -
    > [bind: < 00 00 00 00 00 00 00 22 59 2D F7 52 >,
    > [CREATED [DB=1]],
    > < 00 00 00 00 00 00 00 22 59 2D F7 52 >,
    > NULL,
    > [SUBMITTED [DB=2]],
    > 30, ...
    >
    >
    > It seems to me that if it is going to produce ³comments IS NULL² as part
    of
    > the prepared statement, it shouldnıt try to do a bind parameter, too. It
    is
    > trying to bind the NULL to the commitmentOpenState, when the original
    value
    > was a 2, so it is failing with a locking exception.

    If that's really the case, it's pretty strange.

    org.objectstyle.cayenne.access.trans.UpdateBatchQueryBuilder is where you
    want to look.

    createSqlString() is what generates the query text (once).
    bindParameters() is what binds the parameters (once for each batch data
    set).

    Maybe this is a problem specific to your particular DBAdaptor if it has
    custom handling for this.

    I see there's also a LOBUpdateBatchQueryBuilder, so maybe it's not behaving
    properly if you're triggering that instead.

    It'd probably be a good idea to state what version of Cayenne, and which
    DBAdaptor you're using.

    -Mike



    This archive was generated by hypermail 2.0.0 : Tue May 10 2005 - 15:59:23 EDT