Re: NUMERIC default scale behaves differently on Derby & SQL Server

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Fri Aug 08 2008 - 14:28:44 EDT

  • Next message: Andrus Adamchik: "Re: NUMERIC default scale behaves differently on Derby & SQL Server"

    Here is a potential hole. By default (unless ExtendedType is
    explicitly defined for a given Java class), Cayenne does the following
    JDBC calls:

    PreparedStatement st = ..
    if (scale != -1) {
        st.setObject(pos, val, type, scale);
    }
    else {
        st.setObject(pos, val, type);
    }

    Looks correct from the JDBC standpoint, but from my experience some
    drivers may have it all wrong, and inconsistent with a corresponding
    'setSpecificType(..)' method for a given object class. So what is the
    class of the object parameter? BigDecimal? Something else?

    Andrus

    On Aug 8, 2008, at 2:16 PM, Øyvind Harboe wrote:

    > On Fri, Aug 8, 2008 at 7:53 PM, Andrus Adamchik <andru..bjectstyle.org
    > > wrote:
    >> Cayenne doesn't do anything special on Derby vs. SQLServer in this
    >> respect.
    >
    > My thinking was that databases behaved differently here and that
    > Cayenne then either defines that the default behaviour is undefined
    > when scale is not specified or that Cayenne defines it to be the
    > same as whatever the database does.
    >
    >> Is this behavior happening for selected objects or when binding a
    >> query
    >> parameter?
    >
    > First I run an update w/a prepared statement(or rather Cayenne uses
    > prepared
    > statements for updates) and afterwards the queries return e.g. "1"
    > instead of "1.5".
    >
    > If I run a select statement from *outside* Cayenne, it reveals that
    > the data in
    > the database are actually truncated.
    >
    > Is there a testcase for this in Cayenne?
    >
    > --
    > Øyvind Harboe
    > http://www.zylin.com/zy1000.html
    > ARM7 ARM9 XScale Cortex
    > JTAG debugger and flash programmer
    >



    This archive was generated by hypermail 2.0.0 : Fri Aug 08 2008 - 14:29:24 EDT