DB2 Usage Notes


By default MyBatis Generator will map LONG VARCHAR fields to the java.lang.String data type, and will mark these fields as jdbcType="LONGVARCHAR". This mapping will cause errors when retrieving data from DB2. DB2 LONG VARCHAR fields should be mapped to the java.lang.String data type with jdbcType="VARCHAR". To overcome this problem, use a <columnOverride> as follows:

  <table schema="DB2ADMIN" tableName="ALLTYPES" >
    <columnOverride column="LONG_VARCHAR_FIELD" javaType="java.lang.String" jdbcType="VARCHAR" />