ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James, Steven" <Steven.Ja...@logicacmg.com>
Subject RE: iterate over 2 collections
Date Wed, 03 Aug 2005 12:07:25 GMT
Can we see the parameter class? 

________________________________

From: Eugeny N Dzhurinsky [mailto:eugenydzh@jdevelop.com]
Sent: Wed 03/08/2005 11:51
To: user-java@ibatis.apache.org
Subject: Re: iterate over 2 collections



On Wed, Aug 03, 2005 at 01:25:47PM +0300, Eugeny N Dzhurinsky wrote:
> On Wed, Aug 03, 2005 at 10:40:46AM +0100, James, Steven wrote:
> > did you try it and what were the errors.. 
> for now I'm trying to play with this query.

And finally that's it:

d="dynamicGetRule" resultClass="com.greenvalley.TMS.MML.Entity.Rule">
      select distinct r.rule_id,r.name,r.description from rule r left join rule_field rf
      on r.rule_id = rf.rule_id
  <dynamic prepend=" WHERE ">
    <isNotNull prepend=" AND " property="name"> r.name like #name# </isNotNull>
    <isNotNull prepend=" OR " property="description"> r.description like #description#
</isNotNull>
        <iterate prepend="AND" property="fields"
                     open="(" close=")" conjunction="OR">
                         rf.name like #fields[].name# and rf.value like #fields[].value#
        </iterate>
               
  </dynamic>
  order by name limit #offset#,#limit#</statement>

I created the new bean to keep the information about the field. It seems to work fine, but
I cant make the
<isNotNull property="fields[].name">

iBATIS complains about
com.ibatis.common.jdbc.exception.NestedSQLException:  
--- The error occurred in iBATIS/Rule.xml. 
--- The error occurred while preparing the mapped statement for execution. 
--- Check the dynamicGetRule. 
--- Check the parameter map. 
--- Cause: 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: ""
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.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:188)
        at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForList(GeneralStatement.java:123)
        at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:610)
        at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:584)
Caused by: java.lang.NumberFormatException: For input string: ""
        at com.ibatis.common.beans.BaseProbe.getIndexedProperty(BaseProbe.java:80)
        at com.ibatis.common.beans.ComplexBeanProbe.getProperty(ComplexBeanProbe.java:297)
        at com.ibatis.common.beans.ComplexBeanProbe.getObject(ComplexBeanProbe.java:188)
        at com.ibatis.common.beans.GenericProbe.getObject(GenericProbe.java:57)
        at com.ibatis.sqlmap.engine.mapping.sql.dynamic.elements.IsNullTagHandler.isCondition(IsNullTagHandler.java:32)
        at com.ibatis.sqlmap.engine.mapping.sql.dynamic.elements.IsNotNullTagHandler.isCondition(IsNotNullTagHandler.java:21)
        at com.ibatis.sqlmap.engine.mapping.sql.dynamic.elements.ConditionalTagHandler.doStartFragment(ConditionalTagHandler.java:43)
        at com.ibatis.sqlmap.engine.mapping.sql.dynamic.DynamicSql.processBodyChildren(DynamicSql.java:157)
        at com.ibatis.sqlmap.engine.mapping.sql.dynamic.DynamicSql.processBodyChildren(DynamicSql.java:160)
        at com.ibatis.sqlmap.engine.mapping.sql.dynamic.DynamicSql.processBodyChildren(DynamicSql.java:160)
        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.executeQueryWithCallback(GeneralStatement.java:156)
        ... 21 more


--
Eugene N Dzhurinsky




This e-mail and any attachment is for authorised use by the intended recipient(s) only. It
may contain proprietary material, confidential information and/or be subject to legal privilege.
It should not be copied, disclosed to, retained or used by, any other party. If you are not
an intended recipient then please promptly delete this e-mail and any attachment and all copies
and inform the sender. Thank you.

Mime
View raw message