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 dzizes <dz...@gmail.com> on 2008/03/28 16:17:45 UTC

queryForList with multiple parametrs

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

-- 
View this message in context: http://www.nabble.com/queryForList-with-multiple-parametrs-tp16351019p16351019.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


Re: queryForList with multiple parametrs

Posted by Nedda Kaltcheva <ne...@iexpert.biz>.


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.


RE: queryForList with multiple parametrs

Posted by Jason Kratz <ja...@firm58.com>.
You either have to pass in a parameter map or a class. This is well
documented in the user guide.

-----Original Message-----
From: dzizes [mailto:dzizes451@gmail.com] 
Sent: Friday, March 28, 2008 10:18 AM
To: user-java@ibatis.apache.org
Subject: queryForList with multiple parametrs


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

-- 
View this message in context:
http://www.nabble.com/queryForList-with-multiple-parametrs-tp16351019p163510
19.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.