'mybatis'에 해당되는 글 1건

  1. 2012/02/23 visualp mybatis , select query , return arraylist
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
받은 트랙백이 없고, 댓글이 없습니다.

댓글+트랙백 RSS :: http://blog.visualp.com/rss/response/461

댓글+트랙백 ATOM :: http://blog.visualp.com/atom/response/461