结果类hashmap的Mybatis空值 [英] Mybatis null value for resultype hashmap

查看:341
本文介绍了结果类hashmap的Mybatis空值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<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空值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆