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

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Wed Feb 11 2004 - 00:06:13 EST

  • Next message: Andrus Adamchik: "DTD update, new "query" element"

    On Feb 10, 2004, at 11:58 PM, Andrus Adamchik wrote:
    > UtilDateType and its Oracle-specific subclass - OracleUtilDateType -
    > maybe a suspect here. Try commenting out this line from your local
    > version of OracleAdapter.java:
    >
    > map.registerType(new OracleUtilDateType());

    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:

    1. Create new type handler class:

         public class TestTimestampType extends DefaultType {

             public TestTimestampType() {
                 super(java.sql.Timestamp.class.getName());
             }

             public void setJdbcObject(
                 PreparedStatement st,
                 Object val,
                 int pos,
                 int type,
                 int precision)
                 throws Exception {
                     st.setTimestamp(pos, (java.sql.Timestamp) val);
             }
         }

    2. Register this handler with OracleAdapter:

    public class OracleAdapter ...
         protected void configureExtendedTypes(ExtendedTypeMap map) {
             super.configureExtendedTypes(map);

            ...
             map.registerType(new TestTimestampType());
         }

    Andrus



    This archive was generated by hypermail 2.0.0 : Wed Feb 11 2004 - 00:06:18 EST