61. mybatic insert异常:BindingException: Parameter 'name' not found【从零开始学Spring B】
来源:互联网 发布:聚合数据接口使用 编辑:程序博客网 时间:2024/06/01 20:46
mybatic insert异常:BindingException: Parameter 'name' not found
【从零开始学习Spirng Boot—常见异常汇总】
异常信息如下:
nested exception is org.apache.ibatis.binding.BindingException: Parameter 'name' not found. Available parameters are [0, 1, param1, param2]
出现这个异常的原因是因为你在使用@insert的使用,没有进行相应的字段对应关系。
如下的代码就会报如上的错误:
Java代码
- @Insert("insert into Demo(name,password) values(#{name},#{password})")
- publicvoid save(String name,String password);
那么怎么修改呢?正确的代码应该如下:
Java代码
- @Insert("insert into Demo(name,password) values(#{name},#{password})")
- publicvoid save(@Param("name") String name,@Param("password") String password);
这里使用@Param设置参数的对应关系。
但是如下的代码就不会报错:
Java代码
- @Insert("insert into Demo(name,password) values(#{name})")
- publicvoid save(String name);
当 insert 语句中只有一个参数的,对应的void save方法不需要做任何特殊处理(不需要加@Param也是可以对应上的),当有多个参数的时候,需要使用@Param注解进行字段的对应。
0 0
- 61. mybatic insert异常:BindingException: Parameter 'name' not found【从零开始学Spring B】
- 61.mybatic insert异常:BindingException: Parameter 'name' not found
- 61.mybatic insert异常:BindingException: Parameter 'name' not found
- mybatis多参数查询问题:org.apache.ibatis.binding.BindingException: Parameter 'name' not found. Available par
- org.apache.ibatis.binding.BindingException: Parameter 'name' not found. Available parameters are [1,
- mybatis多参数查询问题:org.apache.ibatis.binding.BindingException: Parameter 'name' not found. Available par
- ibatis.binding.BindingException: Parameter 'XXX' not found
- ibatis.binding.BindingException: Parameter 'xxx' 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
- mybaits异常:org.apache.ibatis.binding.BindingException: Parameter 'date' not found.
- 关于一些mybatis异常的原因:org.apache.ibatis.binding.BindingException: Parameter 'status' not found.
- org.apache.ibatis.binding.BindingException: Parameter 'set' not found
- org.apache.ibatis.binding.BindingException: Parameter '__frch_org_0' not found
- Mybatis异常 Parameter "..." not found
- org.apache.ibatis.binding.BindingException: Parameter 'receptionList' not found. Available parameter
- 异常:Property 'name' not found
- mybatis问题org.apache.ibatis.binding.BindingException: Parameter 'title' not found.
- html+css-内层div设置margin-top不起作用
- TCP/IP协议栈 -----链路层
- leetcode 98. Validate Binary Search Tree
- 算法基础——快速排序
- RS转TTL芯片
- 61. mybatic insert异常:BindingException: Parameter 'name' not found【从零开始学Spring B】
- 局域网DNS劫持
- Glide-通过Modules定制Glide
- 效率提升工具--高级剪贴板Ditto
- Java内存模型与线程
- Openlayers之图形绘制
- eclipse 与git 整合 Egit 用户指南
- jQuery 选择器 - 1
- springmvc中的数据校验