MyBatis Bulk Increase Parameter ' __frch_item_0 ' not found. Available parameters are [list]

Source: Internet
Author: User

This error parameter ' __frch_item_0 ' not found when MyBatis used a foreach. Several solutions for Available parameters are [list]

Example

  <insert id= "insertbatchpicattachment"   parametertype= "java.util.List" >         INSERT INTO Pic_attachment           (pic_id,pic_udid,relate_id, Relate_code,relate_code_dtl,pic_name,pic_url,pic_remote_url)        values        <foreach collection= "list"   item= "item" index= "index" separator= "," >           (#{item.picid},#{item.picudid},#{item.relateid},#{item.relatecode},#{ Item.relatecodedtl},#{item.picname},#{item.picurl},#{item.picremoteurl})        </ foreach>            <selectkey resulttype= "Java.lang.Integer" order= "
After "keyproperty=" Picid ">             select last_insert_id ();        </selectKey>     </insert>

1. View the type of parametertype is not the java.util.List type, and if so, look at the collection property of foreach is not list,

Because passing a List instance or an array to Mybatis,mybatis as a parameter object is automatically wrapped in a Map, the name is used as the key. The list instance will be "list" as the key, and the array instance will be "array" as the key

2. See if the values in foreach are passed in.

3. See if the Name field in the foreach is incorrectly written

4. There is the time when I use the MyBatis, the value of MySQL inserted automatic growth value, the key inside I did not set up in the database automatic growth, and then I used the selectkey, so it will also occur


There should be other mistakes that could lead to this mistake. But I only met these kinds of. So make a summary.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.