itatis 中关于sql的in 语句的问题

dearfashion
07-10-10 1 1461 1

<select id="getMiddlewareVO" resultMap="MiddlewareResult" parameterClass="java.util.Map">
<![CDATA[
select common.id,common.middlewarename,common.gatherdate,data.dataname,data.type,data.used,data.total from mware_common common,mware_data data where common.id=data.id and data.type=#type# and common.middlewarename in
<iterate prepend="AND" conjunction="," close=")" open="(" />
#middlewarename[]#
</iterate>
order by common.id,common.gatherdate
]]>
</select>

java代码:
paramsMap.put("type", new Integer(3));
List middlewarename=new ArrayList();
middlewarename.add("IBM-1570");
middlewarename.add("lenovo-2000M");
paramsMap.put("middlewarename", middlewarename)
dao.getMiddleware(paramsMap);

错误如下:(实在不知道是啊什么愿意)

--- The error occurred while preparing the mapped statement for execution.
--- Check the getMiddlewareVO.
--- Check the parameter map.
--- Cause: com.ibatis.common.beans.ProbeException: Error getting ordinal list from JavaBean. Cause 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:615)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:589)
at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118)
at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:95)
at com.aspire.ss.watch.middleware.dao.MiddlewareDao.getMiddleware(MiddlewareDao.java:47)
at com.aspire.ss.watch.middleware.dao.MiddlewareDao.main(MiddlewareDao.java:88)
Caused by: com.ibatis.common.beans.ProbeException: Error getting ordinal list from JavaBean. Cause java.lang.NumberFormatException: For input string: ""
at com.ibatis.common.beans.BaseProbe.getIndexedProperty(BaseProbe.java:86)
at com.ibatis.common.beans.ComplexBeanProbe.getProperty(ComplexBeanProbe.java:299)
at com.ibatis.common.beans.ComplexBeanProbe.getObject(ComplexBeanProbe.java:199)
at com.ibatis.common.beans.GenericProbe.getObject(GenericProbe.java:74)
at com.ibatis.sqlmap.engine.exchange.ComplexDataExchange.getData(ComplexDataExchange.java:65)
at com.ibatis.sqlmap.engine.mapping.parameter.BasicParameterMap.getParameterObjectValues(BasicParameterMap.java:132)
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:165)
... 7 more
Caused by: java.lang.NumberFormatException: For input string: ""
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at com.ibatis.common.beans.BaseProbe.getIndexedProperty(BaseProbe.java:51)
... 13 more

1
banq
2007-10-11 15:27

>NumberFormatException
这是一个SQL语句输入参数时 数字格式错误。是你的SQL语句有问题,自己单独测试一下。