Mybatis:parameter ' list ' not found. Available parameters are [TemplateID, param1, param2, ValueList]

Source: Internet
Author: User


This article is reproduced to http://www.cnblogs.com/baby-lijun/p/5908088.html



This is the interface defined in my Esdtemplatesealmapper.java.






Public list<esdtemplateseal> Getfilteoutseal (@Param ("filterlist") list<string> List, @Param ("TemplateID ") String TemplateID);
And then my esdtemplatesealmapper.xml inside of the SQL is like this:





<select id= "Getfilteoutseal" resultmap= "Base_result_map" >
        select t.template_id, t.seal_id, T.SEAL_TYPE, T. DATA_SRC, t.version from
        esd_template_seal t
        where T.template_id=#{templateid,jdbctype=varchar} and
        T. Seal_type not
        in <foreach item= "item" collection= "List" separator= "," open= "(" close= ")" index= "" >  
          #{0}< C6/></foreach>  
</select>

It has been written in this way:





<select id= "Getfilteoutseal" resultmap= "Base_result_map" >
        select t.template_id, t.seal_id, T.SEAL_TYPE, T. DATA_SRC, t.version from
        esd_template_seal t
        where T.template_id=#{templateid,jdbctype=varchar} and
        T. Seal_type not
        in <foreach item= "item" collection= "List" separator= "," open= "(" close= ")" index= "" >  
          #{ filterlist}  
        </foreach>  
    </select>


The console is reported similar: 



Org.mybatis.spring.MyBatisSystemException:nested exception is org.apache.ibatis.binding.BindingException: Parameter ' list ' not found. Available parameters are [TemplateID, param1, param2, ValueList]



Question,



The Final Solution is:






<select id= "GetFilteOutSeal2" parametertype= "map" resultmap= "Base_result_map" >
        select t.template_id, T. seal_id, T.seal_type, T.data_src, t.version from
        esd_template_seal t
        where t.template_id=#{id} and
        T.seal _type not
        in <foreach item= "item" collection= "FilterList" separator= "open=" ("close=") "index=" Index >  
          #{item}  
        </foreach>  
</select>

Ps:foreach inside the collection should put something, the wrong understanding is placed in java.util.List, in fact, this type should be the same as our @param binding parameter name

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.