ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Clinton Begin" <clinton.be...@gmail.com>
Subject Re: problems with dynamic sql
Date Thu, 27 Jul 2006 21:01:44 GMT
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 designed.


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