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 Hond4 <ho...@gazeta.pl> on 2005/07/14 09:19:49 UTC

HashMap and SELECT WHERE IN

Hallo list users!

i have one HashMap with ID's. is it possible to create one SQL query

SELECT * FROM table WHERE id IN (1,2,3,4) ?

where can i find some examples of iterate tag ?

Best regards,
H0nd4



Re: HashMap and SELECT WHERE IN

Posted by Daniel Henrique Ferreira e Silva <dh...@gmail.com>.
Hi Honda,

I think the best and simple approach you can take in this situation is
using a List instead of a HashMap (sorry Vic :).

Having a list would allow you to do something like this:

<select id="yourselectId" parameterClass="list" resultMap="map">
  SELECT
    *
  FROM
    table
  <dynamic prepend="WHERE">
      <iterate
        open=" id IN ("
       close=")" conjunction=",">
        #[]#
      </iterate>
  </dynamic>
 </select>


Cheers,
Daniel Silva.

On 7/14/05, Hond4 <ho...@gazeta.pl> wrote:
> Hallo list users!
> 
> i have one HashMap with ID's. is it possible to create one SQL query
> 
> SELECT * FROM table WHERE id IN (1,2,3,4) ?
> 
> where can i find some examples of iterate tag ?
> 
> Best regards,
> H0nd4
> 
> 
>