ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clinton Begin <clinton.be...@gmail.com>
Subject Re: Indexed properties in tags within iterate
Date Thu, 27 Jan 2005 08:21:29 GMT
No, at this time you can't use iterator variables in a tag attribute.

Clinton

On Wed, 26 Jan 2005 17:06:02 -0500, Philippe Laflamme
<philippe.laflamme@mail.mcgill.ca> wrote:
> Hi,
> 
> Is this legal:
> 
> <update id="createDynamicTable" parameterClass="dynamicTableDefinition">
> CREATE TABLE a_dynamic_table
>    <iterate property="columnList" open="(" close=")" conjuction=",">
>      $columnList[].name$
>        <isEqual property="columnList[].type" compareValue="int">
>         INTEGER NULL
>        </isEqual>
>        <isEqual property="columnList[].type" compareValue="double">
>         DOUBLE NULL
>        </isEqual>
>    </iterate>
> </update>
> 
> As you might expect, I'm trying to build a dynamic table from a
> java.util.List of beans each with a "name" and "type" property.
> 
> Currently, I'm getting an expection when iBatis (2.0.9) is trying to
> access the "columnList[].type" value in the isEqual tag. Is this sort of
> construct legal?
> 
> Thanks,
> Philippe
> 
> Here are parts of the stacktrace that might be helpful:
> 
> [...]
> --- The error occurred in dynamicTable.xml.
> --- The error occurred while preparing the mapped statement for execution.
> --- Check the createDynamicTable.
> --- Check the parameter map.
> [...]
> Caused by: com.ibatis.common.beans.ProbeException: Error getting ordinal
> list from JavaBean. Cause java.lang.NumberFormatException: For input
> string: ""
> Caused by: java.lang.NumberFormatException: For input string: ""
>         at com.ibatis.common.beans.BaseProbe.getIndexedProperty(BaseProbe.java:80)
>         at
> com.ibatis.common.beans.JavaBeanProbe.getProperty(JavaBeanProbe.java:261)
>         at com.ibatis.common.beans.JavaBeanProbe.getObject(JavaBeanProbe.java:245)
>         at com.ibatis.common.beans.GenericProbe.getObject(GenericProbe.java:55)
>         at
> com.ibatis.sqlmap.engine.mapping.sql.dynamic.elements.ConditionalTagHandler.compare(ConditionalTagHandler.java:60)
>         at
> com.ibatis.sqlmap.engine.mapping.sql.dynamic.elements.IsEqualTagHandler.isCondition(IsEqualTagHandler.java:21)
>         at
> com.ibatis.sqlmap.engine.mapping.sql.dynamic.elements.ConditionalTagHandler.doStartFragment(ConditionalTagHandler.java:40)
>         at
> com.ibatis.sqlmap.engine.mapping.sql.dynamic.DynamicSql.processBodyChildren(DynamicSql.java:129)
>         at
> com.ibatis.sqlmap.engine.mapping.sql.dynamic.DynamicSql.processBodyChildren(DynamicSql.java:138)
>         at
> com.ibatis.sqlmap.engine.mapping.sql.dynamic.DynamicSql.processBodyChildren(DynamicSql.java:99)
>         at
> com.ibatis.sqlmap.engine.mapping.sql.dynamic.DynamicSql.process(DynamicSql.java:79)
>         at
> com.ibatis.sqlmap.engine.mapping.sql.dynamic.DynamicSql.getParameterMap(DynamicSql.java:61)
>         at
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeUpdate(GeneralStatement.java:55)
>         ... 27 more
>

Mime
View raw message