You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ibatis.apache.org by "Philippe Preville (JIRA)" <ib...@incubator.apache.org> on 2007/08/22 16:48:30 UTC

[jira] Created: (IBATIS-451) CompareProperty in Iterate dynamic tag

CompareProperty in Iterate dynamic tag
--------------------------------------

                 Key: IBATIS-451
                 URL: https://issues.apache.org/jira/browse/IBATIS-451
             Project: iBatis for Java
          Issue Type: Bug
          Components: SQL Maps
    Affects Versions: 2.3.0
         Environment: Java 5.0 - Eclipse
            Reporter: Philippe Preville
            Priority: Minor


iBatis do not iterate on compareProperty in iterate tag it this kind of tag : 

<isEqual property="dynamicRestrictions[].restrictionSeq" compareProperty="dynamicRestrictions[].maxRestrictionSeq">

I found the problem debugging iBatis, the method "compare" in ConditionalTagHandler do not user the "getResolvedProperty" for the compare property.

I simple fix would be to add : 

      String prop2 =  getResolvedCompareProperty(ctx, tag);
      Object value2 = PROBE.getObject(parameterObject, prop2); 

instead of just : Object value2 = PROBE.getObject(parameterObject, comparePropertyName ); 

And add a method like : 

protected String getResolvedCompareProperty(SqlTagContext ctx, SqlTag tag) {
    String prop = tag.getComparePropertyAttr();
    IterateContext itCtx = ctx.peekIterateContext();

    if (prop != null) {

      if(null != itCtx && itCtx.isAllowNext()){
        itCtx.next();
        itCtx.setAllowNext(false);
        if(!itCtx.hasNext()) {
          itCtx.setFinal(true);
        }
      }

      if(prop.indexOf(START_INDEX) > -1) {
        if (itCtx != null) {
          prop = itCtx.addIndexToTagProperty(prop);
        }
      }
    }
      
    return prop;
  }

  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.