org.apache.ibatis.exceptions.PersistenceException:
### Error updating database. Cause: org.apache.ibatis.binding.BindingException: Parameter 'name' not found. Available parameters are [arg1, arg0, param1, param2]
### The error may involve com.imp.IStudents.insertOne-Inline
### The error occurred while setting parameters
### SQL: insert into students(name,pass) values(?,?)
### Cause: org.apache.ibatis.binding.BindingException: Parameter 'name' not found. Available parameters are [arg1, arg0, param1, param2]

mmp ,遇到这个错误弄了半天,在百度上找了半天的教程,在cdsn上看到说是有两种方法可以

但我测试之后只有第一种方法可行

xml文件中的插入语句不要变

   <insert id="insertOne" parameterType="Students">
insert into students(name,age) values(#{name},#{age})
</insert>

改一下接口中的方法的参数

  void insertOne(@Param("name")String name,@Param("age")int age);

IStudents.java

测试方法如下

 @Test
public void testInsertOne() throws Exception {
SqlSession sqlSession = DataBaseManager.getSqlSession();
IStudents mapper = sqlSession.getMapper(IStudents.class);
mapper.insertOne("邢逸", 18);
sqlSession.commit();
}

TestBasic.java

### Cause: org.apache.ibatis.binding.BindingException: Parameter 'name' not found. Available parameters are [arg1, arg0, param1, param2]的更多相关文章

  1. Springboot-001-解决nested exception is org.apache.ibatis.binding.BindingException: Parameter 'env' not found. Available parameters are [arg1, arg0, param1, param2]

    环境:Springboot + Mybatis + MySQL + VUE 场景: 前端发出数据比对请求,在服务后台与数据库交互时,接口提示错误信息如下所示: { "code": ...

  2. SpringBoot整合Mybatis注解版---update出现org.apache.ibatis.binding.BindingException: Parameter 'XXX' not found. Available parameters are [arg1, arg0, param1, param2]

    SpringBoot整合Mybatis注解版---update时出现的问题 问题描述: 1.sql建表语句 DROP TABLE IF EXISTS `department`; CREATE TABL ...

  3. org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter 'userId' not found. Available parameters are [arg1, arg0, param1, param2]

    2018-06-27 16:43:45.552  INFO 16932 --- [nio-8081-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : ...

  4. org.apache.ibatis.binding.BindingException: Parameter '0' not found. Available parameters are [arg1, arg0, param1, param2]

    报错信息如下: org.apache.ibatis.binding.BindingException: Parameter '0' not found. Available parameters ar ...

  5. org.apache.ibatis.binding.BindingException: Parameter 'xxx' not found. Available parameters are [arg1, arg0, param1, param2]

    这个异常说明参数没有加上@Param注解,加上这个注解就行了. 默认情况下mybatis把参数按顺序转化为[0, 1, param1, param2],也就是说#{0} 和 #{param1} 是一样 ...

  6. org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter 'username' not found. Available parameters are [1, 0, param1, param2]

    Spring+mybatis错误:org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.bi ...

  7. org.apache.ibatis.binding.BindingException: Parameter 'start' not found. Available parameters are [1, 0, param1, param2]

    DEBUG 2018-05-30 08:43:26,091 org.springframework.jdbc.datasource.DataSourceTransactionManager: Roll ...

  8. Spring Boot中报错org.apache.ibatis.binding.BindingException: Parameter 'XXXX' not found. Available parameters are [0, 1, param1, param2]的解决办法

    我这里的报错信息显示: org.apache.ibatis.binding.BindingException: Parameter 'reqUsername' not found. Available ...

  9. Mybatis报错 org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter 'parentCode' not found. Available parameters are [0, 1, param1, param2]

    orcal数据库使用mybatis接收参数,如果传的是多个参数,需要使用#{0},#{1},...等代替具体参数名,0 代表第一个参数,1 代表第二个参数,以此类推. 错误语句: <select ...

随机推荐

  1. python已安装了DNS处理模块,执行时却报错ImportError

    一.代码: #!/usr/bin/python import dns.resolver ............此处省略 二.故障报错 ubuntu:~/automation/001_base$ py ...

  2. java中断

    理解java中断 Java中断机制是一种协作机制,即通过中断并不能直接终止另一个线程,而需要被中断的线程自己处理中断.例如,当线程t1想中断线程t2,只需要在线程t1中将线程t2对象的中断标识置为tr ...

  3. 浅析C#之委托、Action、Func

    一.委托 1.1 委托的定义 delegate(委托)是一种可用于封装命名方法或匿名方法的引用类型, 委托类似于 C++ 中的函数指针: .Net通过委托来提供回调函数机制. 声明一个委托类型 int ...

  4. selenium-01 搭建环境

    很老套,但是不得不做的事. selenium的发展史,具体的虫师大大已经写得很具体了:http://www.cnblogs.com/fnng/p/3653793.html 1.第一种使用的姿势就是ID ...

  5. IE 兼容 getElementsByClassName

    getElementsByClassName 通过class获取节点,是很多新人练习原生JS都用到的,项目中也会写,当项目进行到一定程度时,测试IE低版本,忽然发现不支持的时候,瞬间感觉整个人都不好了 ...

  6. Jquery入门(初学者易懂)

    一.定义 jQuery是一个快速.简洁的JavaScript框架,是继Prototype之后又一个优秀的JavaScript代码库(或JavaScript框架).jQuery设计的宗旨是"w ...

  7. 请详细描述(以硬盘启动)Linux系统从打开主机电源到进入登录界面整个过程的流程。

    1. 开机进行BIOS(BIOS(Basic Input / Output System)自检测系统外围硬件设备如CPU.内存.IO.显卡.鼠标键盘等.根据BIOS中设置的系统启动顺序搜索用于启动系统 ...

  8. 来自后端的突袭? --浅尝最新开源的C# Web引擎 Blazor

    在今年年初, 恰逢新春佳节临近的时候. 微软给全球的C#开发者们, 着实的送上了一分惊喜. 微软正式开源Blazor ,将.NET带回到浏览器. 这个小惊喜, 迅速的在dotnet开发者中间传开了. ...

  9. python分支

    if xxx : xxxxx elif xxxx : xxxxx elif xxxx : xxxxx else: xxxxxx 分支可以有效节省CPU的运算时间.避免悬挂else的出现 三元表达式 s ...

  10. node命令curl

    一.打开另一个命令行窗口,运行下面的命令. curl -X POST --data "name=Jack" 127.0.0.1:3000 上面代码使用 POST 方法向服务器发送一 ...