[jira] Created: (CAY-1052) Invalid cast on NUMERICs with scale of 0 using Postgres JDBC 8.2+

From: Dave Dombrosky (JIRA) ("Dave)
Date: Thu May 08 2008 - 11:32:53 EDT

  • Next message: Andrus Adamchik (JIRA): "[jira] Created: (CAY-1051) Drop OracleAdapter "optimizations""

    Invalid cast on NUMERICs with scale of 0 using Postgres JDBC 8.2+
    -----------------------------------------------------------------

                     Key: CAY-1052
                     URL: https://issues.apache.org/cayenne/browse/CAY-1052
                 Project: Cayenne
              Issue Type: Bug
              Components: Cayenne Core Library
        Affects Versions: 1.2 [STABLE], 2.0 [STABLE], 3.0
             Environment: All
                Reporter: Dave Dombrosky
                Assignee: Andrus Adamchik

    A change was recently made in the Postgres JDBC driver, versions 8.2 and up, that makes some of the Cayenne code do the wrong thing now.

    In the TypesMapping class, there is the following code:

    if (type == Types.NUMERIC && precision == 0) {
        type = Types.INTEGER;
    }

    This code no longer works right on the newer drivers because the behavior of the ResultSetMetaData.getScale() method was changed. It used to return "-1" for NUMERICs where it could not determine the scale, but now it returns "0". So values with decimal information are being truncated to integers. Please reference the following thread for more detail on the return value change: http://groups.google.com/group/pgsql.interfaces.jdbc/browse_thread/thread/ee82d41155147672

    -- 
    This message is automatically generated by JIRA.
    -
    You can reply to this email to add a comment to the issue online.
    



    This archive was generated by hypermail 2.0.0 : Thu May 08 2008 - 11:33:18 EDT