原先mapper文件中有如下方法:
<update id="updatePictureRecentclick" parameterType="MenuModel">
update PLATFORM_PICTURE_RECENTCLICK set CLICK_MENU_NAME = #{item.menuName} , MENU_URL = #{item.menuUrl,jdbcType=VARCHAR} where CLICK_MENU_ID = #{item.id}
</update>
当menuName不传值为空时,保存报错:
nested exception is org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='item.menuUrl', mode=IN, javaType=class java.lang.Object, jdbcType=null, numericScale=null, resultMapId='null', jdbcTypeName='null', expression='null'}. Cause: org.apache.ibatis.type.TypeException: 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
修复办法:指明jdbcType=VARCHAR
<update id="updatePictureRecentclick" parameterType="MenuModel">
update PLATFORM_PICTURE_RECENTCLICK set CLICK_MENU_NAME = #{item.menuName} , MENU_URL = #{item.menuUrl,jdbcType=VARCHAR} where CLICK_MENU_ID = #{item.id}
</update>