ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Celaya, Tina \(GE Indust, ConsInd\)" <tina.cel...@ge.com>
Subject RE: problems with dynamic sql
Date Thu, 27 Jul 2006 21:04:33 GMT
Thank you very much, i´ll try ir with the iterate.

-----Original Message-----
From: Clinton Begin [mailto:clinton.begin@gmail.com]
Sent: Jueves, 27 de Julio de 2006 04:02 p.m.
To: user-java@ibatis.apache.org
Subject: Re: problems with dynamic sql

Yep. You want the <iterate> element for dynamic queries.  It will help you avoid the
risks of $substring$ replacement.  The months value in the map should be a List or array[]
of integers.  The year shoudl be an integer or a string, depending on how your database is


On 7/27/06, Celaya, Tina (GE Indust, ConsInd) < tina.celaya@ge.com> wrote: 

I want to put somthing like this in de query moths in (1,2,3,4,5,6) and I tried using month
in ($list$) and list have integers 1,2,3,4,5,6 but it doesnt work, i have an error that says
invalid colum '1,2,3,4,5,6' and i dont know how to solve this so i can have this query 
select * from table where months in (1,2,3,4,5) and year=year
i have this but is not working

<select id="nameID" parameterClass="java.util.Map" resultClass="someClass">
select * from table where months in ($months$) and year=#year#

and i sent a parameter hashmap than has hashmap.add("year",year) and hashmap.add("months",monthsList)
and moths is a List with integers 
thanks for your help

Tina Celaya
GE Consumer & Industrial
Systems Analyst

View raw message