首页 新闻 赞助 找找看

mybatis异常

0
[已解决问题] 解决于 2018-10-21 10:10

xml配置如下:

<update id="updateUsers" parameterType="java.util.List">
 <foreach collection="users" item="item" index="index" open="" close="" separator=";">
update user
<set>
parent_id = 0
</set>
where id = ${item.id} and bjid = ${item.bjid} and njid = ${item.njid}
</foreach>
</update>

mapper如下:
Integer updateUsers(@Param("users") List<user> users);

调用:
userDao.updateUsers(userList);

异常信息如下:
org.mybatis.spring.MyBatisSystemException:nested exception is org.apache.ibatis.exceptions.PersistenceException: \n### Error updating database. Cause: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long\n### The error may involve com.kjm.calm.mmapper.UserDao.updateUserInfo-Inline\n### The error occurred while setting parameters\n### SQL: \n### Cause: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long


        
横槊的主页 横槊 | 初学一级 | 园豆:12
提问于:2018-06-21 12:06
< >
分享
最佳答案
0

你把一个int类型的数据set到了long 类型的 位置上报错了。。检查下你的表结构 是不是这个列设置的类型是long???

奖励园豆:5
队长给我球。 | 菜鸟二级 |园豆:324 | 2018-06-28 18:08
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册