[ 
http://issues.apache.org/jira/browse/IBATIS-361?page=comments#action_12445932 ] 
            
Christian Poitras commented on IBATIS-361:
------------------------------------------

>From what I see, the problem seems to be in GenericProbe.
This method doesn't handle the case where a property might be a List.
Maybe adding a "if (name.indexOf('['))" and removing the array part might 
correct the problem.

I will make a patch and add it here if it solves the problem.

  private Class getClassPropertyTypeForGetter(Class type, String name) {

    if (name.indexOf('.') > -1) {
      StringTokenizer parser = new StringTokenizer(name, ".");
      while (parser.hasMoreTokens()) {
        name = parser.nextToken();
        if (Map.class.isAssignableFrom(type)) {
          type = Object.class;
          break;
        }
        type = ClassInfo.getInstance(type).getGetterType(name);
      }
    } else {
      type = ClassInfo.getInstance(type).getGetterType(name);
    }

    return type;
  }


>  Problem addressing list index in a parameter declaration
> ---------------------------------------------------------
>
>                 Key: IBATIS-361
>                 URL: http://issues.apache.org/jira/browse/IBATIS-361
>             Project: iBatis for Java
>          Issue Type: Bug
>          Components: SQL Maps
>    Affects Versions: 2.2.0
>            Reporter: Reuben Firmin
>
> I have the following code:
> public class Buyer
> {
> ...
>     private Address mailingAddress;
>  
> ...
> public class Address
> {
>     private List<String> addressLine;
> ...
>     public List<String> getAddressLine()
>     {
> In my insert statement, I'm addressing this as:
> #mailingAddress.addressLine[0]#, #mailingAddress.addressLine[1]#,
> When I start the webapp, I'm getting this exception:
> ...
> [11:08:02.736] Caused by: com.ibatis.common.beans.ProbeException: There is no 
> READABLE property named 'addressLine[0]' in class 
> 'com.copart.c2.buyer.bo.Address'
> [11:08:02.736]        at 
> com.ibatis.common.beans.ClassInfo.getGetterType(ClassInfo.java:240)
> [11:08:02.736]        at 
> com.ibatis.common.beans.GenericProbe.getClassPropertyTypeForGetter(GenericProbe.java:221)
> [11:08:02.736]        at 
> com.ibatis.common.beans.GenericProbe.getPropertyTypeForGetter(GenericProbe.java:153)
> [11:08:02.736]        at 
> com.ibatis.sqlmap.engine.mapping.parameter.InlineParameterMapParser.resolveTypeHandler(InlineParameterMapParser.java:229)
> [11:08:02.736]        at 
> com.ibatis.sqlmap.engine.mapping.parameter.InlineParameterMapParser.newParseMapping(InlineParameterMapParser.java:138)
> [11:08:02.736]        at 
> com.ibatis.sqlmap.engine.mapping.parameter.InlineParameterMapParser.parseInlineParameterMap(InlineParameterMapParser.java:50)
> [11:08:02.736]        at 
> com.ibatis.sqlmap.engine.builder.xml.SqlStatementParser.applyInlineParameterMap(SqlStatementParser.java:428)
> [11:08:02.736]        at 
> com.ibatis.sqlmap.engine.builder.xml.SqlStatementParser.processSqlStatement(SqlStatementParser.java:216)
> [11:08:02.736]        at 
> com.ibatis.sqlmap.engine.builder.xml.SqlStatementParser.parseGeneralStatement(SqlStatementParser.java:121)
> [11:08:02.736]        at 
> com.ibatis.sqlmap.engine.builder.xml.SqlMapParser$19.process(SqlMapParser.java:553)
> [11:08:02.736]        at 
> com.ibatis.common.xml.NodeletParser.processNodelet(NodeletParser.java:111)
> I will debug further and will append to this bug.

-- 
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