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. htop命令使用详解

    一.htop 简介 htop 是Linux系统中的一个互动的进程查看器,一个文本模式的应用程序(在控制台或者X终端中),需要ncurses.与Linux传统的top相比,htop更加人性化.它可让用户 ...

  2. java正则匹配并提取字串

    Pattern p = Pattern.compile("\\(.*\\)"); Matcher m = p.matcher("1.2.0(23)"); if( ...

  3. Atlas安装配置

    准备环境 192.168.1.1(Altas) 192.168.1.2(MySQL主) 192.168.1.3(MySQL从) 官方链接:https://github.com/Qihoo360/Atl ...

  4. NGUI_Font

    三.NGUI中的UI字体制作 1.概述: 系统中提供的字体 比较少,而UI字体又是使用最为频繁的,不能因为单一的字体而损失用户量,则这个时候我们就可以通过Font Maker进行字体的制作. 2.动态 ...

  5. Android开发从GC root分析内存泄漏

    我们常说的垃圾回收机制中会提到GC Roots这个词,也就是Java虚拟机中所有引用的根对象.我们都知道,垃圾回收器不会回收GC Roots以及那些被它们间接引用的对象.但是,对于GC Roots的定 ...

  6. Redis查询,设置超时时间

    1.定义 Redis是一个key-value存储系统.和Memcached类似,它支持存储的value类型相对更多,包括string(字符串).list(链表).set(集合).zset(sorted ...

  7. 关于HTML使用ComDlg ActiveX 无法弹出相应对话框的问题1

    最近发现,开发的Web应用在客户的某些IE(8,9,11)中弹出不了Windows的字体对话框. 通过 F12 跟踪,错误代码是“-2146827850”,错误信息是“ 对象不支持ShowFont属性 ...

  8. Java基础学习笔记十五 集合、迭代器、泛型

    Collection 集合,集合是java中提供的一种容器,可以用来存储多个数据. 在前面的学习中,我们知道数据多了,可以使用数组存放或者使用ArrayList集合进行存放数据.那么,集合和数组既然都 ...

  9. web服务器学习1---httpd-2.4.29源码手动编译安装

    环境准备: 系统:CentOS 7.4 软件:httpd-2.4.29 一  Apache主要特点 apache服务器在功能,性能和安全性等方面表现比较突出,可以较好地满足web服务器地应用需求.主要 ...

  10. 02_LInux的目录结构_我的Linux之路

    前两节已经教大家怎么在虚拟机安装Linux系统 这一节我们来学习Linux的目录结构,讲一下linux的整个系统架构,提前熟悉一下Linux 在Linux或Unix系统中有一个非常重要的概念,就是一切 ...