mybatis詭異的bug


在使用mybatis中使用 foreach 時,出現了一個詭異的bug

java文件中是

List<ImportTaskInfoEntity> selectByCalcBatchIds(@Param("ids") List<String> ids);

xml中是

<foreach collection="ids" index="index" item="item"
separator="or" open="(" close=")">
calc_batch_id = #{item}
</foreach>

按理,String直接取是ok,但是卻取不到。查看異常為

Type handler was null on parameter mapping for property '__frch_item_0'. It was either not specified and/or could not be found for the javaType (com.xxx.sale.cmis.entity.AuditTaskEntity) : jdbcType (null) combination.

故猜測,mybatis將集合的元素轉化成了 AuditTaskEntity ,故取值改成  calc_batch_id = #{item.calcBatchId} ,居然就通過了。

實在無解...................


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM