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 "Arora, Parvinder" <PA...@att.com> on 2007/11/20 01:27:24 UTC

Question about iterate tag

Hello all,

 

I just wanted to clarify a doubt before I start coding

 

I have a POJO 

 

Class foo {

String Id1

String Id2

String Id3

}

 

My query is 

 

Select value1, value2 from temp

Where temp.id1 in (comma separated values)

AND temp.id2 in (comma separated values)

AND temp.id3 in (comma separated values)

 

So based upon the tutorial, the statement id should be something like
this?

 

    <statement id="tempQuery"  cacheModel="mycache"
resultMap="myResultMap" >

    <![CDATA[Select value1, value2 from temp

Where temp.id1 in ]]>

                        <iterate property="fooList" open="(" close=")"
conjunction=",">

             #fooList[].Id1#

            </iterate>

    <![CDATA[ and temp.id2 in ]]>

            <iterate property="fooList"  open="(" close=")"
conjunction=",">

             #fooList[].Id2#

            </iterate>

    <![CDATA[ and temp.id3 in ]]>

            <iterate property="fooList"  open="(" close=")"
conjunction=",">

             #fooList[].Id3#

            </iterate>

    </statement>

 

 

Thanks in advance for your help

 

~Parvinder