<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" <[EMAIL PROTECTED]>
To: <[email protected]>
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



  • Select query Balwinder Sodhi
    • Re: Select query Zarar Siddiqi

Reply via email to