Error updating database. Cause: java.lang.ClassCastException: class [Ljava.lang.String; cannot be cast to class java.util.List ([Ljava.lang.String; and java.util.List are in module java.base of loader 'bootstrap')
The error may exist in file [D:\idea01\crm\crm\demo\target\classes\mapper\TRoleMapper.xml]
The error may involve com.example.demo.dao.TRoleDao.updateDel
The error occurred while executing an update
Cause: java.lang.ClassCastException: class [Ljava.lang.String; cannot be cast to class java.util.List ([Ljava.lang.String; and java.util.List are in module java.base of loader 'bootstrap')] with root cause
java.lang.ClassCastException: class [Ljava.lang.String; cannot be cast to class java.util.List ([Ljava.lang.String; and java.util.List are in module java.base of loader 'bootstrap')
你的写法不对哦,应该是这样写的,请参考这个例子修改下:
<update id="updateBatch" parameterType="java.util.List">
<foreach collection="list" item="item" index="index" open="" close="" separator=";">
update course
<set>
name=${item.name}
</set>
where id = ${item.id}
</foreach>
</update>