在使用ibatis和spring时发生的错误
加刚 2011-12-16 10:55:37 org.springframework.dao.DataIntegrityViolationException: SqlMapClient operation; SQL [];
--- The error occurred in com/njty/dao/ibatis/sqlmap/LineRunSQLMap.xml.
--- The error occurred while applying a parameter map.
--- Check the LineRunSQL.queryOnLineCarCnt-InlineParameterMap.
--- Check the statement (query failed).
--- Cause: java.sql.SQLException: ORA-01722: 无效数字
; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in com/njty/dao/ibatis/sqlmap/LineRunSQLMap.xml.
我的bean
private String busLineName;
public String getBusLineName() {
return busLineName;
}
public void setBusLineName(String busLineName) {
this.busLineName = busLineName;
}
sql.xml
<select id="queryNo" parameterClass="busQueryBean" resultMap="locatCarNo">
<![CDATA[
select count(no) as cnt, no, inorout from tab_devcurrstation a0
inner join tybus_his.tab_gpshisdata_current a on a0.devidstr=a.devidstr
where (
a0.lineid in (select t.busline_no from tab_buslines t where t.busline_name like #busLineName# ||'%')
or
a0.lineid in (select t.busline_id from tab_buslines t where t.busline_name like #busLineName# ||'%')
)
and a0.onordown=#inDown#
group by a0.no ,a0.inorout
]]>
</select>
参数传递不进去,改成 '$busLineName$'就正确了。原来是可以用的,实在是不理解,为什么string类型传进去出问题啊!!!!!!!