ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niels Beekman" <n.beek...@wis.nl>
Subject RE: <iterate>
Date Tue, 09 Aug 2005 12:27:38 GMT
You defined a parameter-class list, this is java.util.List, then you
iterate over 'something' which does not exist. If you pass a single
parameter (like you do now) do not use the attribute 'property' of the
iterate-tag:

<select id="getRules" parameterClass="list"
  resultClass="com.greenvalley.TMS.MML.Entity.Rule">SELECT rule_id,
  name, description FROM rule 
  <dynamic prepend=" WHERE ">
      <iterate prepend=" rule_id in " open="(" close=")"
conjunction=",">
	  #[]#
      </iterate>
  </dynamic>
</select>

-----Original Message-----
From: Eugeny N Dzhurinsky [mailto:eugenydzh@jdevelop.com] 
Sent: dinsdag 9 augustus 2005 10:23
To: user-java@ibatis.apache.org
Subject: Re: <iterate>

On Mon, Aug 08, 2005 at 07:46:51PM +0200, Niels Beekman wrote:
> Read carefully, my second sample uses the list directly:
> 
> > When passing the list directly as argument use:
> > 
> > <iterate open="(" close=")">
> >   #[]#
> > </iterate>

what's wrong here:


  <select id="getRules" parameterClass="list"
  resultClass="com.greenvalley.TMS.MML.Entity.Rule">SELECT rule_id,
  name, description FROM rule 
  <dynamic prepend=" WHERE ">
      <iterate property="something" prepend=" rule_id in " open="("
close=")" conjunction=",">
	  #something[]#
      </iterate>
  </dynamic>
  </select>

?

the error is

--- The error occurred in iBATIS/Rule.xml.  
--- The error occurred while preparing the mapped statement for
execution.  
--- Check the getRules.  
--- Check the parameter map.  
--- Cause: java.lang.StringIndexOutOfBoundsException: String index out
of range: -2
Caused by: java.lang.StringIndexOutOfBoundsException: String index out
of range: -2
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 getRules.  
--- Check the parameter map.  
--- Cause: java.lang.StringIndexOutOfBoundsException: String index out
of range: -2
Caused by: java.lang.StringIndexOutOfBoundsException: String index out
of range: -2
        at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQuery
WithCallback(GeneralStatement.java:188)
        at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQuery
ForList(GeneralStatement.java:123)
        at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMap
ExecutorDelegate.java:610)
        at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMap
ExecutorDelegate.java:584)
        at
com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessi
onImpl.java:101)
        at
com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClient
Impl.java:78)

-- 
Eugene N Dzhurinsky

Mime
View raw message