首页 > 数据库技术 > 详细

报错信息是Error setting null for parameter #1 with JdbcType OTHER

时间:2019-04-24 12:30:00      阅读:274      评论:0      收藏:0      [点我收藏+]

报错信息是:nested exception is org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property=‘__frch_item_0.userId‘, mode=IN, javaType=class java.lang.Long, jdbcType=null, numericScale=null, resultMapId=‘null‘, jdbcTypeName=‘null‘, expression=‘null‘}. Cause: org.apache.ibatis.type.TypeException: 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

技术分享图片

报错原因是:传过来的参数类型不对,需要的是一个long型的数据,结果传过来是一个String类型的数据,导致接受不了,网上说在传过来的数据jdbcType=NUMERIC,如下,数据库里number类型的数据写成NUMERIC,发现换了一个错,但是仍然没有解决

<insert id="batchUserRole" useGeneratedKeys="false">
insert all
<foreach item="item" index="index" collection="list">
into sys_user_role(user_id, role_id) values (#{item.userId,jdbcType=NUMERIC},#{item.roleId,jdbcType=NUMERIC}
</foreach>
SELECT 1 FROM DUAL
</insert>

解决办法是:检查前端部分传过来的数据是否正确

 

报错信息是Error setting null for parameter #1 with JdbcType OTHER

原文:https://www.cnblogs.com/zzxzxn/p/10761645.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!