【报错信息】:java.sql.SQLException: 无效的列类型
【原因】:相关mybatis文件中对应语句中的字段有空值
【解决方法】:对可能为空值的字段加非空校验,或者在该字段的参数表达式中加上jdbcType。
例如:
<select id="getList" parameterType="String" resultMap="Person">
SELECT name, age from Person where id = #{id}
</select>
改为
<select id="getList" parameterType="String" resultMap="Person">
SELECT name, age from Person where id = #{id,jdbcType=VARCHAR}
</select>
其中jdbcType后的值根据字段数据类型来负责。