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

相關文章
相關標籤/搜索