ibatis SQLMap文件中xml注释引起的ibatis iterate问题
ibatis运行时报错
ERROR: 17:10:10 (OrderSyncDAOImpl.java:91) {"id":0,"logMessage":"databaseError","logTime":null,"operFrom":-10,"operId":"SGSH","operName":-10,"operTo":-10,"save2Db":true}org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [null]; error code [0]; --- The error occurred in org/ibmp/oba/common/model/sqlmap/oa_v1_ordersync_SqlMap.xml. --- The error occurred while preparing the mapped statement for execution. --- Check the OrderSync.findOrderSync. --- Check the parameter map. --- Cause: com.ibatis.common.beans.ProbeException: Error getting ordinal list from JavaBean. Cause java.lang.NumberFormatException: For input string: ""; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException: --- The error occurred in org/ibmp/oba/common/model/sqlmap/oa_v1_ordersync_SqlMap.xml. --- The error occurred while preparing the mapped statement for execution. --- Check the OrderSync.findOrderSync. --- 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: com.ibatis.common.jdbc.exception.NestedSQLException: --- The error occurred in org/ibmp/oba/common/model/sqlmap/oa_v1_ordersync_SqlMap.xml. --- The error occurred while preparing the mapped statement for execution. --- Check the OrderSync.findOrderSync. --- 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: ""................................下边是有问题的:
<select id="findOrderSync" resultparameterconjunction="or"> synStat = #reTryStat[]# </iterate>) and nextRetryTime < #nowDate#
]]>
</select>
将上边的配置信息改为下边的配置,程序运行正常。
<select id="findOrderSync" resultparameterconjunction="or"> synStat = #reTryStat[]# </iterate>)
<![CDATA[and nextRetryTime < #nowDate#]]>))
</select>
单从ibatis的异常信息里,很难判断是哪里出了问题,请大家注意观察红色部分,就是因为xml的注释造成的ibatis报错。具体什么原因不得而知。我也是折腾了半天才发现这个问题的,在解决问题的时候,当实在不知道哪里出错了,多假设几种原因然后一一验证,说不定那种假设就是原因,这时候就是利用发散思维的时候了 ,
看来解决问题除了一定的经验外,一点点运气,再有就是要看RP值够不够了。 1 楼 gurudk 2012-03-14 兄弟,太给力了,这个问题也困扰我们很久,实在想不通~ 2 楼 obullxl 2012-03-15 我一般不用<![CDATA ]]>这个节点,对于小于号<,直接使用<代替。