sábado, 8 de noviembre de 2014

UncategorizedSQLException: Error setting null for parameter (using Mybatis)

ERROR: UncategorizedSQLException: Error setting null for parameter #11
org.springframework.jdbc.UncategorizedSQLException:
Error setting null for parameter #11 with JdbcType OTHER .
Try setting a different JdbcType for this parameter or a different jdbcTypeForNull configuration property. Cause: java.sql.SQLException:
Invalid column type


Characteristics: Could be another parameter. The error happends when you try to insert a null value. In the mybatis configuration file you must specify the value you want to insert when the query received a NULL (even if its null).

Situation: Using ANT as a compiler, MYBATIS 3.2.7, JDK 1.7.0_51, Struts, Eclipse Kepler, Windows 7, Jboss EAP 6.1

Possible solution: Add on mybatis_config.xml the following setting:

<configuration>  ...
  <settings>
        <setting name="jdbcTypeForNull" value="NULL"/>
    </settings>