Optimistic locking on DATE (java.sql.Date) fields

From: Mike Kienenberger (mkienen..laska.net)
Date: Wed Apr 07 2004 - 15:11:06 EDT

  • Next message: Andrus Adamchik: "Optimistic Locking, Unit Tests, etc."

    One problem I keep encountering under Oracle 9i is the DATE/java.sql.Date
    problem.

    >From what I can tell, the driver sets the fields to 0 for hour/minute/second
    in the SET or INSERT part of a statement, but not for qualifiers in the
    WHERE statement.

    The two solutions I can think of are to always have the cayenne developer
    manually zero those values when setting a new value (either via the
    generated templates or in their code) or change the binding code to somehow
    zero those values.

    The java docs for java.sql.Date(long) appear to indicate that it's the
    driver's responsibility to zero the value:

    =====================================
    public Date(long date)

    Constructs a Date object using the given milliseconds time value. If the
    given milliseconds value contains time information, the driver will set the
    time components to the time in the default time zone (the time zone of the
    Java virtual machine running the application) that corresponds to zero GMT.
    =====================================

    For consistency, it seems like this should probably be done internally by
    Cayenne.

    Thoughts?

    -Mike



    This archive was generated by hypermail 2.0.0 : Wed Apr 07 2004 - 15:10:17 EDT