ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ashish Kulkarni <ashish.kulkarn...@gmail.com>
Subject Question about Dynamic and iterator
Date Mon, 22 Jun 2009 20:39:05 GMT
HiI have to write a query like below

Select col1, col2 from table1 where col3='ABC' or col3='XYZ'

so i wrote a query like below, will this work, *what do i have  to specify
for property, *i have specified it as list, will this work, any suggestions

<select id="getMyInfi" resultClass="com.myclass.Table1"
parameterClass="java.util.List">

SELECT col1, col2 FROM table1
<dynamic prepend="where">
<iterate prepend="AND" *property="list" *
open="(" close=")" conjunction="OR">
col3=*#list[]#*
</iterate>
</dynamic>
</select>

or should i change it to

<parameterMap id="MyMap" class="java.util.Map">
<parameter property="id" javaType="java.util.List" />
</parameterMap>

<select id="getMyInfi" resultClass="com.myclass.Table1"
parameterMap="MyMap">

SELECT col1, col2 FROM table1
<dynamic prepend="where">
<iterate prepend="AND" *property="id" *
open="(" close=")" conjunction="OR">
col3=*#id[]#*
</iterate>
</dynamic>
</select>

Mime
View raw message