ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Heinrich Götzger <goetz...@gmx.de>
Subject Re: How do I use "where ... IN (...)" in my queries still up to date?
Date Mon, 17 Dec 2007 03:37:41 GMT
Larry Meadors wrote:
> Look at the <iterate> tag.
> Larry
thanks, that's the way to go.

... but it had some pitfalls (at least for me).

That's finally what I got:

<select id="getSomeStuff" parameterClass="Map" resultMap="FooBar">
<dynamic prepend="WHERE">
	<iterate property="ids"
		open="id IN ("

Just to have it documented, a single parameter can not be an int[] (or
an Integer[]) it has to be passed in a map. (I did not knew that yet).

So, there has to be prepared a map holding an entry called 'ids' with an
int[] as value.

The example of <iterate>-tag in the iBATIS-book did not make it clear
how to use it in terms of which is a passed property id and which isn't.

And there is probably a typo in Listing 8.7 on page 174 in "iBATIS in
action" because it is not using the []-notation there. But I'm not sure.

Thanks anyway



View raw message