2018-07-20 13:51:30.080 ERROR 5808 --- [nio-8080-exec-8] o.a.c.c.C.[.[.[/].[dispatcherServlet] :
Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception
[Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException:
nested exception is org.apache.ibatis.type.TypeException:
Could not set parameters for mapping: ParameterMapping{property='strTipTitle', 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 #3 with JdbcType OTHER . Try setting a different JdbcType for this parameter or a different jdbcTypeForNull configuration property.
Cause: java.sql.SQLException: 无效的列类型: 1111] with root cause
映射文件插入的values形如#{name}中不含jdbcType=,即#{strPic2,jdbcType=VARCHAR}导致的错误
源代码
<insert id="addTipMsg" parameterType="com.les.weixin.dao.AdminTip">
<selectKey keyProperty="strTipId" resultType="java.lang.String" order="BEFORE">
SELECT seq_admin_tip_msg.NEXTVAL AS strTipId FROM DUAL
</selectKey>
insert into admin_tip_msg
(str_tip_id,
str_person_name,
str_person_telphone,
str_tip_title,
str_tip_description,
str_tip_pic1,
str_tip_pic2,
str_tip_state,
str_tip_source,
str_tip_type,
comments,
comm,
createtime,
districtid,
x,
y)
values(
${strTipId},
#{strPersonName},
#{strPersonTelphone},
#{strTipTitle,jdbcType=VARCHAR},
#{strTipDescription},
#{strPic1,jdbcType=VARCHAR},
#{strPic2,jdbcType=VARCHAR},
#{strTipState},
#{strTipSource},
#{strTipType},
#{comments},
#{openid,jdbcType=VARCHAR},
to_date(#{createtime},'YYYY-MM-DD HH24:MI:SS'),
#{districtId,jdbcType=VARCHAR},
#{x,jdbcType=VARCHAR},
#{y,jdbcType=VARCHAR})
</insert>