结果类型 hashmap 的 Mybatis 空值 [英] Mybatis null value for resultype hashmap
问题描述
<select id="getData" parameterType="Object" resultType="map">
select query.* from (${query}) query
</select>
这就是我要执行的查询.虽然查询是正确的并返回了所需的数据,但是当数据插入到指定的 resultType map 中时,某些列中的空值会被忽略.
So this is the query I want to execute. Although the query is correct and returning the desired data, but when the data is inserted in the resultType map as specified the null values present in some of the columns get omitted.
我已经搜索/谷歌搜索了相同的内容,但没有得到我想要的.我还查看了 这个链接,但无法得到我的答案.
I have searched/googled for the same, but not got what I want. I also viewed this link, but can't get my answer.
有什么方法可以得到那些被忽略/消失的值?
Is there any way to get those omitted/disappeared values?
推荐答案
有设置callSettersOnNulls
,见这里.默认值为 false,因此不会对 null
值调用 setter,但您可以将其设置为 true.
There is the setting callSettersOnNulls
, see here. The default is false, so no setter will be called on a null
value, but you can set it to true.
这篇关于结果类型 hashmap 的 Mybatis 空值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!