You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ibatis.apache.org by "Walter So (JIRA)" <ib...@incubator.apache.org> on 2005/02/02 00:26:17 UTC

[jira] Commented: (IBATIS-38) Support for arrays or list parameter using "IN" keyword

     [ http://issues.apache.org/jira/browse/IBATIS-38?page=comments#action_58457 ]
     
Walter So commented on IBATIS-38:
---------------------------------

Clinton Begin wrote on
Tue, 28 Dec 2004 08:15:32 -0800:

There is support for this.  It's an odd syntax though.

Try:

> <select id="getAmount" parameterClass="java.util.List" >
>         select
>             ID, AMOUNT
>         from
>             TABLE
>         where ID IN (#[]#)
> </select>

I tried this using 2.0.9 (496), but I got the following:

java.lang.RuntimeException: Error occurred.  Cause: com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/sqlMap'.  Cause: com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMap/select'.  Cause: com.ibatis.common.beans.ProbeException: There is no READABLE property named '[]' in class 'java.util.List'

Is there something else I need to do?

> Support for arrays or list parameter using "IN" keyword
> -------------------------------------------------------
>
>          Key: IBATIS-38
>          URL: http://issues.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://issues.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