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