ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Butler" <jeffgbut...@gmail.com>
Subject Re: Help with parametermap ( List in a Map )
Date Fri, 05 Sep 2008 18:09:22 GMT
The second form looks correct to me (the first form is definitely not
right).  Suggest you turn on logging and see what's being generated.

Jeff Butler

On Fri, Sep 5, 2008 at 8:43 AM, leo71 <online.itch@gmail.com> wrote:

>
> Hi
> I am trying to set a list in a map as the parameterMap
>
> See the code below
>
>  <select id="getInfo" parameterClass="java.util.HashMap"
> resultMap="someResult">
>        SELECT
>                firstName AS firstName,
>                lastName AS lastName
>                FROM employee
>        WHERE employee_dept_id = #employeeDeptId#
>         and class_id in
>        <iterate property="classId" open="(" close=")" conjunction=",">
>         #[],javaType=java.lang.Integer,jdbcType=INTEGER#
>        </iterate>
>
>  </select>
>
>  Java part is
>  List classId= new ArrayList();
>  classId.add(new Integer(0));
>  classId.add(new Integer(1));
>  classId.add(new Integer(2));
>
>  HashMap parameters = new HashMap();
>  parameters.put("employeeDeptId", "ABC123");
>  parameters.put("classId", classId);
>
>  List classifiedEmployees =
> getTemplate().queryForList("getClassifiedEmployees",parameters);
>
>  It gives me the following
>  --- Cause: com.ibatis.common.beans.ProbeException: Error getting ordinal
> list from JavaBean. Cause java.lang.NumberFormatException: For input
> string:
> ""
>
>
> I tried changing it  like this
>        <iterate property="classId" open="(" close=")" conjunction=",">
>         #classId[],javaType=java.lang.Integer,jdbcType=INTEGER#
>        </iterate>
>
>        That solves the exception problem but does not return any rows even
> though
> it should return 2 rows
>
> Please let me know if any one can help me with this. I spend a lot of time
> but did not find good documentation on how parameter maps
> should be created with lists inside maps. I tried to debug into the ibatis
> code but am not getting anywhere.
> --
> View this message in context:
> http://www.nabble.com/Help-with-parametermap-%28-List-in-a-Map-%29-tp19331531p19331531.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>

Mime
View raw message