Uploaded image for project: 'iBatis for Java [READ ONLY]'
  1. iBatis for Java [READ ONLY]
  2. IBATIS-754

JDBCType for unsigned data not respected and mismapped. jdbc unsigned integer type maps to Integer instead of Long as it is supposed to. Causes data loss!

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 3.0 Beta 9
    • 3.0 Beta 10
    • Core
    • None

    Description

      Create a database using MySQL with unsigned integer types using camelCase (which should represent java Long values as specified). Query the database with a HashMap return result. Result from a query returns 2 mapped results for each parameter, one capitalized, one using the original camelCase parameter, and one in all upper case. The upper case value is correct (a Long value). The camelCase parameter is downcast to an Integer.

      I traced it to UnknownTypeHandler.java line 62. For the camelCase mappings, there is a ResultSetMetaData entry, and the entry returns a JdbcType of INTEGER which is correct. The rsmd.getColumnClassName is java.long.Long (which should be a huge hint as to the java type, but you don't retrieve that value).

      You then poll your typeHandlerRegistry and return an Integer java type converter, which is very incorrect. The result is that the result is downcast to an Integer instead of a long causing data loss and programatic errors where a Long is expected and instead an Integer is provided.

      Attachments

        Activity

          People

            cbegin Clinton Begin
            xtianstone Christian Wolfgang Stone
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: