Re: Optimistic Locking Progress report 5 - problems with Oracle 9i DATE/TIMESTAMP lockings

From: Mike Kienenberger (mkienen..laska.net)
Date: Mon Feb 16 2004 - 13:08:29 EST

  • Next message: Mike Kienenberger: "Optimistic Locking: How DATE field comparision is broken in Oracle 9i and possible options"

    Andrus Adamchik <andru..bjectstyle.org> wrote:
    > Actually this is not the correct way to prove my suspicion, sorry.
    > Instead you should map your TIMESTAMP column as java.sql.Timestamp (not
    > java.util.Date), and try this:
    >
    > st.setTimestamp(pos, (java.sql.Timestamp) val);

    Hi Andrus.

    Thanks for your help with this, but changing the binding from setObject to
    setTimestamp didn't make a difference.

    I created an example test program which I'm going to submit as an oracle
    driver bug. I've tried it with both setObject and setTimestamp, and the
    date locking fails each way. As I mentioned before, I had the same problem
    with WebObjects last year, but I didn't have the knowledge to create a JDBC
    example (or source code to prove it was the cause), but I was able to do
    that today by tracing how it's done in Cayenne.

    My next suspicion is that the Oracle DATE database type doesn't have enough
    precision as the java.sql.Timestamp. So the database rounds the value when
    inserting, but fails to round the value when comparing. This would also
    explain why making WebObjects zero all timestamp fields solved the problem.

    -Mike



    This archive was generated by hypermail 2.0.0 : Mon Feb 16 2004 - 13:08:22 EST