I would try
<select id="getMyInfi" resultClass="com.myclass.Table1"
parameterClass="java.util.List">
SELECT col1, col2 FROM table1
<dynamic prepend="where">
<iterate prepend="AND" property=""
open="(" close=")" conjunction="OR">
col3=#[]#
</iterate>
</dynamic>
</select>
But, you need to have a type handler registered for the objects in the list or
#[]# will be replaced by toString(). If you list contains Strings or numeric
values, it's ok.
Christian
________________________________
From: Ashish Kulkarni [mailto:[email protected]]
Sent: Monday, June 22, 2009 4:39 PM
To: [email protected]
Subject: Question about Dynamic and iterator
Hi
I 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>