Hello.
Maybe I just missed it, but I didn't see an example of iterating over
beans in the documentation. The examples I've seen only show iterating
over simple Lists of String objects. While the syntax for iterating over
beans is intuitive, I just thought I'd share this example. Sorry if it's
old news and documented somewhere that I just overlooked. If you'd like
I'll add it to a wiki somewhere (are you using Confluence or MoinMoin?).
Iterating over a bean list in a SqlMap Example:
Suppose you have an bean object like:
Event
Timestamp transactionDate
Long eventID
And perhaps a simple wrapper bean such as:
ParameterBean
List events // a java.util.List of Events
You can iterate over the ParameterBean's List as follows:
<select id="iterateExample" resultMap="myMap"
parameterClass="parameterBean">
select * from event_table
<dynamic prepend="where">
<iterate property="events" conjunction=" OR ">
event_id = #events[].eventID#
and
event_date = #events[].transactionDate#
</iterate>
</dynamic>
</select>
---
jaaron