[ 
http://issues.apache.org/jira/browse/IBATIS-131?page=comments#action_12317664 ] 

Niels Beekman commented on IBATIS-131:
--------------------------------------

I also believe it is still broken, I checked the JUnit-tests but none of them 
is using a property containing []-syntax. If you use my example or just extend 
the JUnit-test you'll notice the failure. I adapted the statement 
'dynamicIterate' in DynamicAccount.xml which is called from IterateTest.java:

  <select id="dynamicIterateInConditional"
    parameterClass="list"
    resultClass="testdomain.Account">
    select
      ACC_ID          as id,
      ACC_FIRST_NAME  as firstName,
      ACC_LAST_NAME   as lastName,
      ACC_EMAIL       as emailAddress
    from ACCOUNT
    WHERE ACC_ID IN
    <iterate open="(" close=")" conjunction=",">
        <isEqual property="[]" compareValue="1">
            #[]#
        </isEqual>
    </iterate>
  </select>

  public void testIterateInConditional() throws SQLException {
    List params = Arrays.asList(new Integer[]{new Integer(1), new Integer(2), 
new Integer(3)});
    List list = sqlMap.queryForList("dynamicIterateInConditional", params);
    assertEquals(1, list.size());
    assertAccount1((Account) list.get(0));
  }

This query should produce Account1, instead it crashes.

> Fix use of list[]-notation in propertyattributes of dynamic tags
> ----------------------------------------------------------------
>
>          Key: IBATIS-131
>          URL: http://issues.apache.org/jira/browse/IBATIS-131
>      Project: iBatis for Java
>         Type: Bug
>   Components: SQL Maps
>  Environment: All are affected.
>     Reporter: Niels Beekman
>     Assignee: Brandon Goodin
>      Fix For: 2.1.5

>
> When using an iterate-tag to loop a list, one cannot point to the current 
> element in attributes of inner tags, for example, the following fails:
> <iterate property="myList">
>   <isEqual property="myList[].someProperty" compareValue="true">
>     $myList[].anotherProperty$
>   </isEqual>
> </iterate>
> iBATIS tries to index the property myList with an empty string, but it should 
> use the current element (the []-notation works fine within inner tags), when 
> an index is supplied it works just fine...

-- 
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
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to