@Override
    public Stream<T> stream() {
        setState(State.ESTABLISH);
        try {
            SqlQueryLoggerUtil.logOperation(LOGGER_STREAM, getSql(), getValues());

            connectionInfo = connectionInfoSupplier.get();
            connectionInfo.ifNotInTransaction(c -> c.setAutoCommit(false)); // Streaming results must be autocommit false for PostgreSQL
            ps = connectionInfo.connection().prepareStatement(getSql(), java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY);
            statementConfigurator.accept(ps);

            //System.out.format("*** PreparedStatement: fetchDirection %d, fetchSize %d%n", ps.getFetchDirection(), ps.getFetchSize());

            int i = 1;
            for (final Object o : getValues()) {
                ps.setObject(i++, o);
            }
            rs = ps.executeQuery();
            resultSetConfigurator.accept(rs);

            //System.out.format("*** ResultSet: fetchDirection %d, fetchSize %d%n", rs.getFetchDirection(), rs.getFetchSize());

        } catch (SQLException sqle) {
            LOGGER.error(sqle, "Error executing " + getSql() + ", values=" + getValues());
            throw new SpeedmentException(sqle);
        }
        setState(State.OPEN);
        return InternalStreamUtil.asStream(rs, getRsMapper(), parallelStrategy);
    }
@author pemi
@param <T> The type that the ResultSet shall be mapped to
runtime-parent/runtime-core/src/main/java/com/speedment/runtime/core/internal/db/AsynchronousQueryResultImpl.java