Result Maps collection does not contain value for xxxx

这是mybatis查询返回值的错误,我在做一个查询数值的方法,但是我是这样写的:

    <select id="findSize" resultMap="long">
        select count(1) from advertisement
    </select>
<!-- 注意是resultMap -->

其实如果是返回数值的话,就不应该写resultMap,而是resultType,看下面的代码:

    <select id="findSize" resultType="long">
        select count(1) from advertisement
    </select>

细节方面还是需要注意的

原文地址:https://www.cnblogs.com/itiande/p/9616268.html