본문 바로가기
Database/query

map -> ibatis -> query

by windrises 2008. 9. 30.
------JAVA------
Map<String, String> params = new HashMap<String, String>();

for (int k = 0; k < values.length; k++) {
   params.put("value" + Integer.toString(k), values[k]);
}

queryForList("ibatis_query_id", params);

------ QUERY xml ------
<select id="ibatis_query_id" parameterClass="java.util.Map" resultMap="res-map">
     <![CDATA[
  SELECT * FROM member_list
         WHERE no = #no#
           AND userId IN (#value1#,#value2#,#value3#,#value4#,#value5#,#value6#)
]]>
 </select>