mybatis deal with empty result list. 查询结果为empty。

List<User> resultList = (List<User>)sqlSession.select("statementId");


<select id="statementId" resultType="User">
   select * from user where id > 100
</select>

assume that the above SQL return no rows (i.e. there is no id greater than 100).java

The variable resultList will then be an empty List, but I want it to be null instead. How can I do that?sql


结果:spa

      若是没有查询到结果,将会返回一个empty的r esultlist,而后resultlist 的size 是0 而不是null.code

相关文章
相关标签/搜索