ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nate Weiss <n...@twintechs.com>
Subject Re: how to pass two different types of values to query in IBATIS
Date Mon, 12 Apr 2010 15:35:43 GMT
On 4/12/2010 10:24 AM, mukhi wrote:
>
> Thanks, but the parameter 'entryrefno' is of numeric type in my table. How
> can i pass two different types of values to Map  at the same time?
> Please reply me. I am struck at this point.

If you added that numeric value to your map before you passed it in, 
like I typed in my little example, then you would be able to refer to 
the value with the name "entryRefno" inside your query. You can use that 
name because that's the name after the dot here:

 >> params.entryRefno= myEntryRefno;

Not sure what version of iBatis you are using, but in iBatis 3 which is 
what I am most familar with, you would do something like:

SELECT * FROM MyTable
WHERE entryRefno = #{entryRefno, jdbcType=INTEGER}
AND ...


>> Hi mukhi--
>>
>> I'm pretty new to this list, but I believe the general solution is to
>> make a HashMap and pass that in:
>>
>> Map params = new HashMap();
>> params.entryRefno= myEntryRefno;
>> params.someList = someList;
>> getSqlMapClientTemplate().insert("insertChoice", params);
>>
>> In iBatis 3 you also have the option of creating a mapper interface
>> class which allows you to pass in multiple params without a map.
>>
>>
>> On 4/11/2010 3:41 PM, mukhi wrote:
>>>
>>> I am using Spring with Ibatis. I want to pass a sting value and list to a
>>> query. How I can do that.
>>>
>>> My query is as follows
>>> INSERT INTO
>>>                   T_ENTRY_ANSWER_ASSOC( ENTRY_REFNO,   CHOICE_REFNO  )
>>>
>>>                       SELECT  #entryRefno#,CHOICE_REFNO,
>>>                        FROM T_CHOICE
>>>                        WHERE CHOICE_REFNO IN ( 90,89,93,45,67)
>>>
>>>
>>>
>>> in the above query i need to pass two types of parameters.
>>> 1. Sting
>>> 2.list of values in where clause.
>>>
>>> How can i do it?
>>>
>>>
>>> What kind of parameter I can pass to call the query. while making call
>>>
>>> getSqlMapClientTemplate().insert("insertChoice",  What parameter goes
>>> here?);
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>> For additional commands, e-mail: user-java-help@ibatis.apache.org
>>
>>
>>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Mime
View raw message