You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Heinrich Götzger <go...@gmx.de> on 2007/12/13 16:48:25 UTC
How do I use "where ... IN (...)" in my queries still up to date?
Hi,
is the wiki-article 'How do I use "where ... IN (...)" in my queries'
in
http://opensource.atlassian.com/confluence/oss/pages/viewpage.action?pageId=5925
still up to date?
Or is there another, more convenient and secure solution possible today?
Thanks
Cheers
Heinrich
Re: How do I use "where ... IN (...)" in my queries still up to date?
Posted by Heinrich Götzger <go...@gmx.de>.
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 ("
conjunction=","
close=")">
#ids[]#
</iterate>
</dynamic>
[...]
</select>
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
Cheers
Heinrich
Re: How do I use "where ... IN (...)" in my queries still up to date?
Posted by Larry Meadors <lm...@apache.org>.
Look at the <iterate> tag.
Larry
On Dec 13, 2007 8:48 AM, Heinrich Götzger <go...@gmx.de> wrote:
> Hi,
>
> is the wiki-article 'How do I use "where ... IN (...)" in my queries'
> in
> http://opensource.atlassian.com/confluence/oss/pages/viewpage.action?pageId=5925
> still up to date?
>
> Or is there another, more convenient and secure solution possible today?
>
> Thanks
>
> Cheers
>
> Heinrich
>