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 Li Ma <li...@gmail.com> on 2008/04/17 03:10:09 UTC

Pass multiple parameters using Map

Hi,

Here's a newbie question for iBATIS:
I need to pass three parameters to a <select> query. I don't want to create
a new class just for this one query, so I tried to use Map as parameterClass
even parameterMap, nothing worked.
Anyone can provide a sample of doing such kind of task? I did Google and
search iBATIS mailinglist, but found nothing. So please help!

Thanks!

-- 
Li Ma
lima01@gmail.com
http://www.idealtechs.com

Re: Pass multiple parameters using Map

Posted by Brandon Goodin <br...@gmail.com>.
Map param = new HashMap();param.put("someProp",someValue);
param.put("otherProp",someOtherValue);
sqlMapClient.queryForList("Foo.selectForSomething",param);

<select id="selectForSomething" parameterClass="map"
resultClass="SomeDomainClass">
select id,someColumn,someOtherColumn,someName from foo where
someColumn=#someProp# and someOtherColumn=#otherProp#
</select>

Brandon Goodin

On Wed, Apr 16, 2008 at 8:10 PM, Li Ma <li...@gmail.com> wrote:

> Hi,
>
> Here's a newbie question for iBATIS:
> I need to pass three parameters to a <select> query. I don't want to
> create a new class just for this one query, so I tried to use Map as
> parameterClass even parameterMap, nothing worked.
> Anyone can provide a sample of doing such kind of task? I did Google and
> search iBATIS mailinglist, but found nothing. So please help!
>
> Thanks!
>
> --
> Li Ma
> lima01@gmail.com
> http://www.idealtechs.com