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

From: Mike Kienenberger (mkienen..laska.net)
Date: Thu Feb 12 2004 - 19:02:54 EST

  • Next message: Mike Kienenberger: "Optimistic Locking: reproducable but inexplicable failure"

    Andrus, I'm not sure if this relevent to the issue, but I remember back when
    we switched from Oracle 8 to Oracle 9, I had to modify the WebObjects
    version of this project to truncate all NSTimestamp fractional seconds with
    the following code.

    My original posting showed up on a google search and probably explains the
    situation details better than I can remember a year later.

    But basically, dates arrived from the database without nanoseconds, but
    dates were sent to the database with nanoseconds due to changes in the
    Oracle driver. At least, that was the guess without having WO source and
    trying to examine the Oracle logging output.

    http://www.omnigroup.com/mailman/archive/webobjects-dev/2003-
    April/033127.html

    This also seems to fall along the lines of what you're suggesting (switching
    to TIMESTAMP and using java.sql.Timestamp).

    If this is the case, what needs to happen to insure that both the DATE and
    TIMESTAMP Oracle SQL types work as expected under optimistic locking? For
    TIMESTAMP, maybe it's as simple as converting to java.sql.Timestamp. For
    Date, does it mean we need to modify outgoing date values to zero the
    nanosecond field?

    -Mike

        public Application()
        {
            super();

            EOAdaptor.setDefaultDelegate(new OracleHackEOAdaptorDelegate());
            }

        public class OracleHackEOAdaptorDelegate extends Object
        {
            public Object adaptorFetchedValueForValue(EOAdaptor adaptor, Object
    value, EOAttribute attribute)
            {

                Object newValue = value;
                if (value instanceof NSTimestamp)
                {
                    newValue = new NSTimestamp(((NSTimestamp)value).getTime(),
    0);
                }
                    return newValue;
            }
        };



    This archive was generated by hypermail 2.0.0 : Thu Feb 12 2004 - 19:02:49 EST