mybatis执行update语句:
<update id="updateBatchId" parameterType="java.util.HashMap">
update TABLE1
set BATCHID = #{batch_id}
where BUSINESS_NO = #{commit_id,jdbcType=VARCHAR}
</update>
报错:
Error setting null for parameter #1 with JdbcType OTHER . Try setting a different JdbcType for this parameter or a different jdbcTypeForNull configuration property. Cause: java.sql.SQLException: 无效的列类型: 1111
; uncategorized SQLException for SQL []; SQL state [99999]; error code [17004]; 无效的列类型: 1111; nested exception is java.sql.SQLException: 无效的列类型: 1111
找原因发现batch_id与dao层传入的名称不一致,应为batchid
修改为:
<update id="updateBatchId" parameterType="java.util.HashMap">
update TABLE1
set BATCHID = #{batchid}
where BUSINESS_NO = #{commit_id,jdbcType=VARCHAR}
</update>
执行正常。