ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vincent <vinc...@xaymaca.com>
Subject Re: ArrayList as parameter
Date Sat, 26 Mar 2005 13:46:05 GMT
Mr Begin is (of course) correct, a Map or bean would be a more
natural solution:

Map myMap = new HashMap();
myMap.put("employeeID",employeeID);
myMap.put("grade",grade);

queryForList("emp" ,myMap);

select id="emp" resultClass="java.util.ArrayList"
  parameterClass="java.util.Map">
     SELECT employee_name  FROM employee
     WHERE  employee_id= #employeeID#  and grade=#grade#
   </select>


Also, Setting the result class to an ArrayList seems weird to me.
It seems like the system is designed to return a List of javabeans
rather than a List of Lists.

Vincent




srividhya umashanker wrote:
> ArrayList
> ----------------
> List list = new ArrayList();
> list.add("123");
> list.add("A");
> 
> queryForList("emp" ,list);
> 
> <select id="emp" resultClass="java.util.ArrayList"
> parameterClass="java.util.ArrayList">
>    SELECT employee_name  FROM employee
>    WHERE  employee_id= ? and grade=?
>  </select>
> 
> How to apply the iterate tag to get the following query
> 
>    SELECT employee_name  FROM employee   WHERE  employee_id= 123 and
> grade='A'
> 


-- 
Plato is my friend, Aristotle is my friend, but my greatest friend is truth.
- Isaac Newton

Mime
View raw message