Mybatis error: Parameter & #39; list & #39; not found. Available parameters are [groupList, param1], mybatisgrouplist

Source: Internet
Author: User

Mybatis error: Parameter 'LIST' not found. Available parameters are [groupList, param1], mybatisgrouplist

Methods defined in GroupDao. java:

Void batchInsertLog (@ Param ("groupList") List <MktPromotionIntegralLog> groupList );

 

GroupMapper. xml before modification

<Insert id = "batchInsertLog" parameterType = "java. util. List">
Insert into table
(Ps_id, goods_id, item_number, goods_name)
Values
<Foreach collection = "list" item = "log" index = "groupList" separator = ",">
(# {Log. ps_id}, # {log. goods_id}, # {log. item_number}, # {log. goods_name })
</Foreach>
</Insert>

 

An error is returned when you execute the batchInsertLog method:

Parameter 'LIST' not found. Available parameters are [groupList, param1]

 

Modified GroupMapper. xml

<Insert id = "batchInsertLog" parameterType = "java. util. List">
Insert into table
(Ps_id, goods_id, item_number, goods_name)
Values
<Foreach collection = "groupList" item = "log" index = "groupList" separator = ",">
(# {Log. ps_id}, # {log. goods_id}, # {log. item_number}, # {log. goods_name })
</Foreach>
</Insert>

 

An error is reported after modification.

The cause of this problem is that the collection in foreach should be stored in java. util. list, but it should be the same as the parameter name bound to @ Param ("groupList") in Dao. If @ Param is not used, the GroupMapper before the modification. xml is not a problem.

Related Article

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.