zoukankan      html  css  js  c++  java
  • ### Cause: org.apache.ibatis.binding.BindingException: Parameter 'name' not found. Available parameters are [arg1, arg0, param1, param2]

    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文件中的插入语句不要变

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

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

    1  void insertOne(@Param("name")String name,@Param("age")int age);
    IStudents.java

    测试方法如下

    1 @Test
    2     public void testInsertOne() throws Exception {
    3         SqlSession sqlSession = DataBaseManager.getSqlSession();
    4         IStudents mapper = sqlSession.getMapper(IStudents.class);
    5         mapper.insertOne("邢逸", 18);
    6         sqlSession.commit();
    7     }
    TestBasic.java
  • 相关阅读:
    函数Sort()
    数据窗口中数值型对象的显示格式
    函数IsValid()
    20130109显示器无反应
    DropDownPictureListBox设置默认项
    大数据
    字符串函数Mid()
    Jquery获取当前元素所在表格的行列数
    关于模式窗口中treeView问题
    格式化字符串长度 超出指定长度用....代替
  • 原文地址:https://www.cnblogs.com/xyblogs/p/8724194.html
Copyright © 2011-2022 走看看