Posted
Filed under spring framework
In mybatis passing array list is as simple as passing a map into

please follow the below codes

Any Dao method like

   List<domain.blog.Post> selectPostIn ( List<String> params );

And the Dao.xml
<select id="selectPostIn" resultType="domain.blog.Post"  parameterType="java.util.List">
 SELECT * FROM POST P WHERE ID in
    <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
      #{item}
    </foreach>
</select>
Just make sure collection name should be "list" only
You can pass a List instance or an Array to MyBatis as a parameter object. When you do, MyBatis will automatically wrap it in a Map, and key it by name. List instances will be keyed to the name “list” and array instances will be keyed to the name “array”

I have tried with list its working
2012/02/23 16:33 2012/02/23 16:33

blog.visualp.com