[
http://nagoya.apache.org/jira/browse/IBATIS-38?page=comments#action_57090 ]
Walter So commented on IBATIS-38:
---------------------------------
Hi Roberto,
Thanks for the suggestion. I tried using the iterate tag, but as you said, it
is expecting a property of type java.util.List. I had to make a crude
workaround by making a JavaBean with one List property for the iterate tag to
work. It won't accept a List directly as a parameterClass.
Even though I was able to make <iterate> work, I found my solution
counter-intuitive. I think my request for iBATIS to implicitly handle arrays,
lists or even other Collection classes is still valid for convenience reasons.
My scenario is to run two queries, passing in the primary keys from the first
query into the second like this:
Map map1 = client.queryForMap("query1", param, "idField");
Map map2 = client.queryForList("query2", map1.keySet() ); // query2 uses the
primary keys inside a IN (?) keyword
> Support for arrays or list parameter using "IN" keyword
> -------------------------------------------------------
>
> Key: IBATIS-38
> URL: http://nagoya.apache.org/jira/browse/IBATIS-38
> Project: iBatis for Java
> Type: New Feature
> Components: SQL Maps
> Environment: Any
> Reporter: Walter So
> Priority: Minor
>
> I have a need for the following kind of query:
> <select id="getAmount" parameterClass="java.util.List" >
> select
> ID, AMOUNT
> from
> TABLE
> where ID IN (#ids#)
> </select>
> To generate:
> select ID, AMOUNT from TABLE where ID IN (1001, 1002, 1003, 1004)
> #ids# can also be int[], String[] or Object[] array. Will there be any
> support for these kinds of parameters? Thanks.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira