Mybatis null value for resultype hashmap

廉价感情. 提交于 2019-12-30 12:38:30

问题


<select id="getData" parameterType="Object" resultType="map"> 
    select query.* from (${query}) query 
</select>

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?


回答1:


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.



来源:https://stackoverflow.com/questions/34871449/mybatis-null-value-for-resultype-hashmap

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!