Mybatis异常 Parameter "..." not found
来源:互联网 发布:淘宝店铺产品布局 编辑:程序博客网 时间:2024/05/16 06:44
异常内容:
Cause: org.apache.ibatis.binding.BindingException: Parameter 'title' not found. Available parameters are [1, 0, param1, param2]
- 异常发生描述:
在整合SpringMVC & Mybatis开发时,系统结构大致分为Controller层、Mapper层、PO层和Service层;在Service调用Mapper的 Update 时,出现了问题。 - com.wqt.ssm.Service.StudentService (interface)
void updateStudent(Integer id,Student student)throws Exception;
- com.wqt.ssm.Mapper.StudentMapper (interface)
void updateStudent(Integer id,Student student)throws Exception;
- com.wqt.ssm.Mapper.StudentMapper.xml
<update id="updateStudent" parameterType="com.wqt.ssm.PO.Student"> update student set Name=#{name},Sex=#{sex}... where id=#{id}</update>
分析:
注意Mapper.xml中update的parameterType,参数类型表明是PO类,但是在Mapper中的方法updateStudent形参却存在其他形参”Integer id”,所以在传递参数类型时,Mybatis的binding组件无法正确匹配参数类型,从而导致出现上面的异常。解决:
传递的Integer id主要是在Service层中用于一些数据处理,如验证等等;连带着放进了Mapper中导致了问题的出现,则将Mapper对应方法中的其他形参去掉即可,Service的形参则按需求决定是否要保留。
0 0
- Mybatis异常 Parameter "..." not found
- 关于运行期异常 :MyBatis异常Parameter 'title' not found
- Mybatis出现Parameter not found
- mybatis Parameter 'XXX' not found问题
- Mybatis foreach 问题 Parameter 'item' not found
- Mybatis 参数无法获取Parameter not found
- mybatis报错Parameter '**' not found
- mybatis异常:org.apache.ibatis.binding.BindingException: Parameter 'param' not found. Available param
- mybatis异常:org.apache.ibatis.binding.BindingException: Parameter 'param' not found. Available param
- mybatis 批量增加 报异常 Parameter '__frch_item_0' not found. Available parameters are [list]
- 关于一些mybatis异常的原因:org.apache.ibatis.binding.BindingException: Parameter 'status' not found.
- Mybatis foreach异常Parameter '__frch_item_0' not found. Available parameters are [list]
- MyBatis报Parameter not found的Exception 处理
- Mybatis junit测试时报: parameter *** not found.available 错误处理
- mybatis. Parameter 'xxxList' not found. Available parameters are [c
- MyBatis的坑(Parameter 'XXX' not found)
- 61.mybatic insert异常:BindingException: Parameter 'name' not found
- 61.mybatic insert异常:BindingException: Parameter 'name' not found
- Markdown|书单
- 用键盘控制改变实体色彩
- thinkpad t430u win10小红点无反应/停止响应
- 【NOIP提高组五校联考】道路规划
- JAG Practice2016-E Similarity of Subtrees- hash
- Mybatis异常 Parameter "..." not found
- 第一次出现一次的字符
- (转)如何学习盈透api的开发?
- Java并发:其他(总结性的东西)
- hdu5524Subtrees+递归模拟
- Unity3D 更新远程文件下载器
- javaweb mvc设计模式
- 51 单片机晶振电路原理
- HTTP POST GET 本质区别详解