Parameter ‘id‘ not found. Available parameters are [collection, list]

简介: Parameter ‘id‘ not found. Available parameters are [collection, list]

Parameter ‘id’ not found. Available parameters are [collection, list]


我这边报错是sql写的有问题:


换成下面的就OK;


<!--<insert id="addOnce" parameterType="com.example.democrud.democurd.pojo.userdemo">
      insert  into user
      <trim prefix="(" suffix=")" suffixOverrides="," >
          <if test="id != null" >
              id,
          </if>
          <if test="name != null" >
              name,
          </if>
          <if test="age != null" >
              age,
          </if>
          <if test="password != null" >
              password,
          </if>
          <if test="newdate != null" >
              newdate,
          </if>
      </trim>
      <trim prefix="values (" suffix=")" suffixOverrides="," >
          <if test="id != null" >
              #{id,jdbcType=VARCHAR},
          </if>
          <if test="name != null" >
              #{name,jdbcType=VARCHAR},
          </if>
          <if test="age != null" >
              #{age,,jdbcType=VARCHAR},
          </if>
          <if test="password != null" >
              #{password,jdbcType=VARCHAR},
          </if>
          <if test="newdate != null" >
              #{newdate,jdbcType=DATE},
          </if>
      </trim>
  </insert>-->
    <insert id="addOnce" parameterType="int">
        insert into user (id,name,age,password,newdate)
        values
        <foreach collection="list" item="item" separator=",">
            (
            #{item.id}, #{item.name},#{item.age},#{item.password},#{item.newdate}
            )
        </foreach>
    </insert>
相关文章
|
1月前
|
Java API
List转Map(id为key,list为value)
List转Map(id为key,list为value)
52 0
|
1月前
Cause: java.sql.SQLIntegrityConstraintViolationException: Column ‘id‘ in field list is ambiguous
Cause: java.sql.SQLIntegrityConstraintViolationException: Column ‘id‘ in field list is ambiguous
30 0
|
8月前
|
存储 算法 Java
java集合框架------Collection接口,List接口与实现类,Set接口与实现类
java集合框架------Collection接口,List接口与实现类,Set接口与实现类
|
1月前
|
SQL XML Java
<foreach>元素中collection=list改成collection=array
<foreach>元素中collection=list改成collection=array
|
1月前
|
存储 Java 索引
从零开始学习 Java:简单易懂的入门指南之Collection集合及list集合(二十一)
从零开始学习 Java:简单易懂的入门指南之Collection集合及list集合(二十一)
|
Java 数据库连接 mybatis
mybatis关于出现Parameter ‘XXX‘ not found. Available parameters are [collection, list]问题的解决方案
mybatis关于出现Parameter ‘XXX‘ not found. Available parameters are [collection, list]问题的解决方案
623 0
|
1月前
|
存储 算法 Java
【Java 集合框架API接口】Collection,List,Set,Map,Queue,Deque
【Java 集合框架API接口】Collection,List,Set,Map,Queue,Deque
|
1月前
|
SQL IDE Java
MyBatis【问题 01】mapper传入array\collection\list类型的参数时报BindingException:Parameter ‘xx‘ not found问题复现及解决
MyBatis【问题 01】mapper传入array\collection\list类型的参数时报BindingException:Parameter ‘xx‘ not found问题复现及解决
88 0
|
7月前
|
SQL Java 数据库连接
Mybatis使用collection标签实现一对多关联查询,返回结果集list中嵌套list
Mybatis使用collection标签实现一对多关联查询,返回结果集list中嵌套list
204 0
使用Stream 对List同一个id的某个字段进行计算
使用Stream 对List同一个id的某个字段进行计算
75 0