title: Hibernate List vs. JDBC ResultSet
body: <p>Hibernate is very good for <strong>code readability</strong> and  <strong>database portability</strong> </p>
  
  <p>However I realize that Hibernate takes a lot of memory. Here is an example </p>
  
  <p><strong>HIBERNATE VERSION</strong> </p>
  
  <pre><code> String hql = "FROM Employee";
      Query query = session.createQuery(hql);
      List results = query.list(); // this list is limited my the size of my RAM 
  </code></pre>
  
  <p><strong>JDBC VERSION</strong> </p>
  
  <pre><code>ResultSet resSet = connection.executeQuery("SELECT * FROM Employee"); 
  while (resSet.next()) { 
  // This resSet is not limited to my RAM
  } 
  </code></pre>
  
  <p>So if I have a query that returns hundreds of thousands of rows, I should better handle it with JDBC, because then I can process each row sequentially, and this does not take all my RAM. </p>
  
  <p><strong>Am I correct? Or does Hibernate have any sort of "streaming List" similar to ResultSet object that does not "flood" RAM ?</strong> </p>