ibatis-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Butler (JIRA)" <ibatis-...@incubator.apache.org>
Subject [jira] Commented: (IBATIS-297) iBATIS doesn't remap sql fully
Date Thu, 25 May 2006 23:26:30 GMT
    [ http://issues.apache.org/jira/browse/IBATIS-297?page=comments#action_12413317 ] 

Jeff Butler commented on IBATIS-297:

If the number of conditions is dynamic, you can also use the <iterate> tag like this:

select # from myTable
<iterate prepend="where" conjunction="and" property="conditions">
  $conditions[].condition$ #conditions[].value#

Where "conditions" is a List property of your parameter object, and the list contains Maps
setup like my previous comment.

You can make more elaborate expressions than this using nested iterate tags (which is available
in SVN now, but not released until iBATIS 2.2.0).  There is an example of this in SVN in the
tests for the nested iterate tags.  Send me a note if you need a link.

BTW - The next version of Abator will use this idea to allow you to generate a virtually unlimited
dynamic where clause.

> iBATIS doesn't remap sql fully
> ------------------------------
>          Key: IBATIS-297
>          URL: http://issues.apache.org/jira/browse/IBATIS-297
>      Project: iBatis for Java
>         Type: Bug

>   Components: SQL Maps
>     Versions: 2.1.5
>     Reporter: adamb

> iBATIS doesn't remap parameters.
> If I have statement with remapResults="true":
> select * from mytable where $dynamicWhereClause$
> and pass in the following two parameters: 
> dynamicWhereClause                              #key#='abc'
> key                                                                 java.lang.String="abc"
> Then the remap puts the #key# in the sql directly, rather than rechecking the statement
to determine what the parameters will be, so gives the error
> message:
> java.sql.SQLException: ORA-00911: invalid character 
> because it hasn't recognised the new hash parameters.
> Version tested on:
> iBATIS 2.1.5

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:

View raw message