mybatis解决insert时候空值问题

mybatis在insert的时候,当对象里面有空值的时候,插入不成功,需要在SqlMapperConfig.xml中进行设置;

"jdbcTypeForNull" value="NULL" />

org.apache.ibatis.exceptions.PersistenceException:

SQL: INSERT INTO USER_S (id,username,birthday,sex,address) VALUES(?,?,?,?,?)

Cause: org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property=’address’, mode=IN, javaType=class java.lang.String, jdbcType=null, numericScale=null, resultMapId=’null’, jdbcTypeName=’null’, expression=’null’}. Cause: org.apache.ibatis.type.TypeException: Error setting null for parameter #5 with JdbcType OTHER . Try setting a different JdbcType for this parameter or a different jdbcTypeForNull configuration property. Cause: java.sql.SQLException: 无效的列类型: 1111

你可能感兴趣的:(mybatis)