ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nedda Kaltcheva <nedda.kaltch...@iexpert.biz>
Subject Re: queryForList with multiple parametrs
Date Sun, 30 Mar 2008 20:57:27 GMT



dzizes wrote:
> 
> Hi,
> 
> I was wandering how queryForList with 2 (or more) parameters. Below my
> select in sqlmap.xml
> 
>   <select id="getAB" resultClass="com.ab.server.AB">
>         SELECT A, B
>         FROM tableAB
>         WHERE A = '14' AND B = '01'
>   </select>
> 
> List responseList = sqlMap.queryForList("getAB", "?", "?");
> 
> Please help me with replacing 14/01 and ?? with proper parameters.
> 
> Greets,
> dzizes
> 
> 

This is one way to do it:

<select id="getAB" resultClass="com.ab.server.AB"
parameterClass="SearchClass">
         SELECT A, B
         FROM tableAB         
         WHERE A =  #searchClassFieldA# AND B = #searchClassFieldB#
</select>


So, that is what the mapped statement looks like, and here is how you would
call it:
queryForList("getAB",searchObject);

where searchObject is of class SearchClass and has fields searchClassFieldA
and searchClassFieldB set to your values of 14 and 01 respectively.
-- 
View this message in context: http://www.nabble.com/queryForList-with-multiple-parametrs-tp16351019p16387388.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


Mime
View raw message