parametermap으로 String []을 전달해서 select 처리할 때 변수로 사용해 보고자 했다.
흑~ 값이 전달 되지 않는다... 이유는 무엇인가? 이틀 무렵이나 구글 신(?)에서 질문을 했으나, 답이 찾아지지 않는다.
그런던 이튼날 답을 찾았다. ㅋ~
String[] aString
HashMap <String, object> paramenterMap = new HaspMap<>();
paramemterMap.put("stringArr", aString);
...파라미터 전달은 이 정도...
xml에서 sql은 어떻게?
<select id="select" resultType="resultVo" parameterType="map">
select * from table_name
where key in
<foreach collection="stringArr" item="item" open="(" close=")" separator=",">
'${item}'
</foreach>
</select>이렇게 코딩하면 끝...
이전에는 #{item}이라고 코딩하면 될 꺼라 믿었고... 구글 신(?)이 알려주는 해법(?)들도 많은 글들이 그렇게 되어 있었지만...
결국에는 '${item}' 이 답이라는 결론(?)을 얻었다. ㅠㅠ;
댓글 없음:
댓글 쓰기