ibatis中传入数组的解决方案(转载)

来源:互联网 发布:异构系统数据迁移 编辑:程序博客网 时间:2024/05/22 00:04

 

版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明
http://feipingzhao.blogbus.com/logs/33394105.html

It's very simple, however iBATIS documentation doesnot state this. Suppose you need to issue a query with an IN (....)criterion and you need to pass an array of values into it:

 

  <select id="getSmth" resultClass="myclass">
select name, body from myclass_table where name in (
<iterate conjunction=",">#[]#</iterate>
)
</select>

 

The essential condition for success is - don't specify the parameterClass attribute in select and don't specify property in iterate, otherwise the query won't work.

原创粉丝点击