you can pass a list in directly...just use the following syntax...
<select id="dynamicIterate"
parameterClass="list"
resultClass="testdomain.Account">
select
ACC_ID as id,
ACC_FIRST_NAME as firstName,
ACC_LAST_NAME as lastName,
ACC_EMAIL as emailAddress
from ACCOUNT
WHERE ACC_ID IN
<iterate open="(" close=")" conjunction=",">
#[]#
</iterate>
</select>
Brandon
On Thu, 10 Mar 2005 11:19:11 +0100, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
> Thanks for that good suggestion.
>
> It works fine even if the sql query is :
> SELECT * FROM OPERATIONS WHERE (OPERATION_ID=1 OR OPERATION_ID=8)
>
> I was wondering if the iterate would launch the query for each value, but
> with the logging I saw that query and it's OK for me.
>
> One more thing. To call the iterate, I have to create an object which
> contain the array :
>
> public class IBatisIterateList {
> int[] ids;
>
> public void setIds(int[] ids) {
> this.ids = ids;
> }
>
> public int[] getIds() {
> return ids;
> }
> }
>
> Wouldn't it be possible to pass the list directly (as a list, an inner
> class, or something else)?
> EG:
> sqlMap.queryForList("getRoleOperations", (new int[]{1,8)))
> -----Original Message-----
> From: Brandon Goodin [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 10, 2005 1:49 AM
> To: [email protected]
> Subject: Re: Sql Select question
>
> yes, look into the <iterate> tag of the dynamic sql. It's all in the user
> guide.
>
> Hope that helps,
> Brandon
>
> On Wed, 9 Mar 2005 15:02:34 +0100, [EMAIL PROTECTED]
> <[EMAIL PROTECTED]> wrote:
> >
> >
> > Hi,
> >
> > I would like to have in an sqlMap a select like this :
> >
> > SELECT * FROM OPERATIONS WHERE OPERATION_ID IN (1,3, 7, 9)
> >
> > I can't find a way to specify the list of values in the where statement.
> >
> > Is it possible? How do you do that?
> >
> > Thanks
> > Walther
>