@SuppressWarnings("unchecked")
    @Override
    public <T> CloseableIterator<T> iterate(Query query, @Nullable final FactoryExpression<?> projection) {
        Iterator<T> iterator = query.getResultList().iterator();
        if (projection != null) {
            return new TransformingIterator<T>(iterator, projection);
        } else {
            return new IteratorAdapter<T>(iterator);
        }
    }
{@code DefaultQueryHandler} is the default implementation of the {@link QueryHandler} interface

@author tiwe
querydsl-jpa/src/main/java/com/querydsl/jpa/DefaultQueryHandler.java