mybatis执行时报错内容如下:
Error setting null for parameter #2 with JdbcType OTHER . Try setting a different JdbcType for this parameter or a different jdbcTypeForNull configuration property. Cause: java.sql.SQLException: 无效的列类型: 1111
MyBatis 插入空值时,需要指定JdbcType
解决办法:
<insert id="add" parameterType="Customer">
insert into LG_CUSTOMER(id,
customerCode,
organization,
logo,
customerName,
shorthandCode,
createDate)
values(#{id,jdbcType=VARCHAR},
#{customerCode,jdbcType=VARCHAR},
#{organization,jdbcType=VARCHAR},
#{logo,jdbcType=VARCHAR},
#{customerName,jdbcType=VARCHAR},
#{shorthandCode,jdbcType=VARCHAR},
#{createDate,jdbcType=VARCHAR})
</insert>