@SuppressWarnings("unchecked")
    private CloseableIterator<T> iterateSingle(QueryMetadata metadata, @Nullable final Expression<T> expr) {
        SQLListenerContextImpl context = startContext(connection(), queryMixin.getMetadata());
        String queryString = null;
        List<Object> constants = Collections.emptyList();

        try {
            listeners.preRender(context);
            SQLSerializer serializer = serialize(false);
            queryString = serializer.toString();
            logQuery(queryString, serializer.getConstants());
            context.addSQL(getSQL(serializer));
            listeners.rendered(context);


            listeners.notifyQuery(queryMixin.getMetadata());
            constants = serializer.getConstants();

            listeners.prePrepare(context);
            final PreparedStatement stmt = getPreparedStatement(queryString);
            setParameters(stmt, constants, serializer.getConstantPaths(), metadata.getParams());
            context.addPreparedStatement(stmt);
            listeners.prepared(context);

            listeners.preExecute(context);
            final ResultSet rs = stmt.executeQuery();
            listeners.executed(context);

            if (expr == null) {
                return new SQLResultIterator<T>(configuration, stmt, rs, listeners, context) {
                    @Override
                    public T produceNext(ResultSet rs) throws Exception {
                        return (T) rs.getObject(1);
                    }
                };
            } else if (expr instanceof FactoryExpression) {
                return new SQLResultIterator<T>(configuration, stmt, rs, listeners, context) {
                    @Override
                    public T produceNext(ResultSet rs) throws Exception {
                        return newInstance((FactoryExpression<T>) expr, rs, 0);
                    }
                };
            } else if (expr.equals(Wildcard.all)) {
                return new SQLResultIterator<T>(configuration, stmt, rs, listeners, context) {
                    @Override
                    public T produceNext(ResultSet rs) throws Exception {
                        Object[] rv = new Object[rs.getMetaData().getColumnCount()];
                        for (int i = 0; i < rv.length; i++) {
                            rv[i] = rs.getObject(i + 1);
                        }
                        return (T) rv;
                    }
                };
            } else {
                return new SQLResultIterator<T>(configuration, stmt, rs, listeners, context) {
                    @Override
                    public T produceNext(ResultSet rs) throws Exception {
                        return get(rs, expr, 1, expr.getType());
                    }
                };
            }

        } catch (SQLException e) {
            onException(context, e);
            endContext(context);
            throw configuration.translate(queryString, constants, e);
        } catch (RuntimeException e) {
            logger.log(Level.SEVERE, "Caught " + e.getClass().getName() + " for " + queryString);
            onException(context, e);
            endContext(context);
            throw e;
        } finally {
            reset();
        }
    }
Get the results as a JDBC ResultSet

@return results as ResultSet
querydsl-sql/src/main/java/com/querydsl/sql/AbstractSQLQuery.java