title: How is MyBatis dealing with an empty result set?
body: <p>Recently I was using Mybatis3 and found that when your SQL statement gets an empty result set from the database, Mybatis creates a new <code>List</code> and returns it to your program.</p>
  
  <p>Given some code, like:</p>
  
  <pre><code>List&lt;User&gt; resultList = (List&lt;User&gt;)sqlSession.select("statementId");
  
  &lt;select id="statementId" resultType="User"&gt;
     select * from user where id &gt; 100
  &lt;/select&gt;
  </code></pre>
  
  <p>assume that the above SQL return no rows (i.e. there is no id greater than 100).</p>
  
  <p>The variable <code>resultList</code> will then be an empty <code>List</code>, but I want it to be <code>null</code> instead.
  How can I do that?</p>