ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rashmi Dixit" <rash...@gmail.com>
Subject RE: iterate over java.Util.List
Date Wed, 14 Jun 2006 13:24:37 GMT
Thanks for the quick reply Jeff.


Is there some place which has all that is supported and whats not
documented somewhere? Or did I just not read the document carefully





From: Jeff Butler [mailto:jeffgbutler@gmail.com] 
Sent: Wednesday, June 14, 2006 6:47 PM
To: user-java@ibatis.apache.org
Subject: Re: iterate over java.Util.List


You cannot pass the list directly as the parameter object - the list
needs to be a property of some other object.  You could put the list in
a map:


Map map = new HashMap();

map.put("list", theList);


then make your parameter class java.util.Map


Jeff Butler


On 6/14/06, Rashmi Dixit <rashmid@gmail.com> wrote: 


I have a select statement to which I want to attach a where clause with
an "IN". The values for the IN are BigDecimals which I would like to 
pass as a java.util.List. (Note: I know this list will not be empty,
will be adding dynamic prepend later).

<select id="trial" resultMap="uploadQueueResult"
parameterClass="java.util.List ">
       select ID from sometable
               <iterate property="list"
                       open="FACILITYID in ("

I am getting an error when I execute this

--- Check the parameter map. 
--- Cause: java.lang.StringIndexOutOfBoundsException: String index out
of range: -2

What am I doing wrong here? Even if I use "value" instead of "list" as
the property value, I get the same exception. I haven't been able to 
find enough iterate examples even after a google search. All examples
iterate over some property of the parameter class or a Map.

Any help will be appreciated.



View raw message