Hi, In org.hibernate.query.internal.ScrollableResultsIterator there is {{ public boolean hasNext() { return !scrollableResults.isClosed() && scrollableResults.next(); } }} I use the DB2 driver jcc-11.5.0.0.jar which autocloses the result set after the last row has been fetched (https://www.ibm.com/support/pages/invalid-operation-result-set-closed-error-data-server-driver-jdbc) Now, if I use a Stream<Entity> as return type of method returning the result of a query, the JDBCException from org.hibernate.internal.ScrollableResultsImpl.next() is thrown inside my lambda evaluation. I would suggest that inside next() there would be a call to resultSet.isClosed() just like {{ public boolean next() { try { if (this.getResultSet().isClosed()) return false; boolean result = this.getResultSet().next(); this.prepareCurrentRow(result); return result; } catch (SQLException var2) { throw this.convert(var2, "could not advance using next()"); } } }} What do you think? Regards, Uwe |