Question about type precision vs. CHAR

From: Holger Hoffstätte (holge..izards.de)
Date: Thu May 22 2003 - 10:20:40 EDT

  • Next message: Andrus Adamchik: "Re: Question about type precision vs. CHAR"

    Working on the DB2 adapter I'm making good progress; most failures right
    now are related to the one below:

      <system-out><![CDATA[[05-22 16:09:18 main] DEBUG ContextCommit: Creating
    InsertBatchQuery for DbEntity CHAR_PK_TEST
    [05-22 16:09:18 main] INFO QueryLogger: --- will run 1 query.
    [05-22 16:09:18 main] INFO QueryLogger: INSERT INTO CHAR_PK_TEST
    (OTHER_COL, PK_COL) VALUES (?, ?)
    [05-22 16:09:18 main] INFO QueryLogger: [batch params: 'object-XYZ',
    'PK1']
    [05-22 16:09:18 main] INFO JdbcAdapter: object: object-XYZ pos: 1
    sqlType: 1 precision: -1
    [05-22 16:09:18 main] INFO QueryLogger: *** error.
    com.ibm.db2.jcc.c.SqlException: Invalid argument: scale must be greater
    than or equal to 0 and less than 32.
            at com.ibm.db2.jcc.c.cm.g(cm.java:2238)
            at com.ibm.db2.jcc.c.cm.a(cm.java:868)
            at com.ibm.db2.jcc.c.cm.setObject(cm.java:858)
            at
    org.objectstyle.cayenne.access.types.AbstractType.setJdbcObject(AbstractType.java:74)
            at
    org.objectstyle.cayenne.access.types.CharType.setJdbcObject(CharType.java:155)
            at
    org.objectstyle.cayenne.dba.JdbcAdapter.bindParameter(JdbcAdapter.java:432)
            at
    org.objectstyle.cayenne.access.trans.BatchQueryBuilder.bindParameters(BatchQueryBuilder.java:143)
            at
    org.objectstyle.cayenne.access.DataNode.runBatchUpdateAsIndividualQueries(DataNode.java:546)
            at
    org.objectstyle.cayenne.access.DataNode.runBatchUpdate(DataNode.java:471)

    Look at the line I added for JdbcAdapter: precision for CHAR types seems
    to be -1. I cannot find any place where this is configured (it probably
    indicates a missing value); any hints about how to fix this? Would
    creating a new CharType and overriding setJdbcObject() be the right place
    to substitute -1 for, say, 0?

    Holger



    This archive was generated by hypermail 2.0.0 : Thu May 22 2003 - 10:20:14 EDT