问题描述
<select id="getData" parameterType="Object" resultType="map">
select query.* from (${query}) query
</select>
所以这是我要执行的查询。尽管查询是正确的并返回所需的数据,但是当数据插入到resultType 映射中时,省略了某些列中的空值。
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空值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!