title: Hibernate .getResultStream() not streaming?
body: <p>I am trying to stream a lot of data from MySQL with Hibernate via <code>.getResultStream()</code> and I am getting OutOfMemoryErrors. </p>
  
  <p>On the first row load after a while I will get this exception where I can see:</p>
  
  <pre><code>    at com.mysql.jdbc.MysqlIO.nextRow(MysqlIO.java:1963) ~[mysql-connector-java-5.1.37.jar:5.1.37]
      at com.mysql.jdbc.MysqlIO.readSingleRowSet(MysqlIO.java:3308) ~[mysql-connector-java-5.1.37.jar:5.1.37]
      at com.mysql.jdbc.MysqlIO.getResultSet(MysqlIO.java:463) ~[mysql-connector-java-5.1.37.jar:5.1.37]
      at com.mysql.jdbc.MysqlIO.readResultsForQueryOrUpdate(MysqlIO.java:3032) ~[mysql-connector-java-5.1.37.jar:5.1.37]
      at com.mysql.jdbc.MysqlIO.readAllResults(MysqlIO.java:2280) ~[mysql-connector-java-5.1.37.jar:5.1.37]
      at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2673) ~[mysql-connector-java-5.1.37.jar:5.1.37]
  </code></pre>
  
  <p>what surprises me here is the <code>readAllResults</code> - this would seem it is not a real streaming.</p>
  
  <p>I also tried to use:</p>
  
  <pre><code>query.setHint("org.hibernate.fetchSize", 1000)
  </code></pre>
  
  <p>With no effect.</p>
  
  <p>I have then upgraded to MySQL Connector 8.0.19 and Hibernate 5.4.11.Final with the same effect.</p>