ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Zarar Siddiqi" <zarar.sidd...@utoronto.ca>
Subject Re: Select query
Date Mon, 03 Oct 2005 13:04:46 GMT
<iterate> : Iterates over a property that is of type java.util.List

Example Usage:

<iterate prepend="AND" property="userNameList" open="(" close=")" 
conjunction="OR">
     username=#userNameList[]#
</iterate>

Note: It is very important to include the square brackets[] at the end of 
the List property name when using the Iterate element. These brackets 
distinguish this object as an List to keep the parser from simply outputting 
the List as a string.

This is from Page 39 of the Java Developer Guide.

Zarar


----- Original Message ----- 
From: "Balwinder Sodhi" <balwinder.sodhi@gmail.com>
To: <user-java@ibatis.apache.org>
Sent: Monday, October 03, 2005 12:33 AM
Subject: Select query


> Hello,
>
> My requirement is to place a query like:
>
> SELECT a, b, c FROM my_table WHERE a IN (some_list)
>
> in the SQLMap. Now this 'some_list' can be an instance of
> java.util.List or java.util.Collection etc. I am not able to figure
> out how can I configure such a query.
>
> Can this be done by using some construct like:
>
> <!-- Assuming myResult etc. is defined -->
> <select id="getMyData" resultMap="myResult" 
> parameterClass="what_to_put_here?">
> SELECT a, b, c FROM my_table WHERE a IN (#what_to_put_here?#)
> </select>
>
> Any help will be greatly appreciated.
>
> Regards,
> Balwinder
> 



Mime
View raw message