@Nullable
    private Object getSingleResult(Query query) {
        if (projection != null) {
            Object result = query.getSingleResult();
            if (result != null) {
                if (!result.getClass().isArray()) {
                    result = new Object[]{result};
                }
                return projection.newInstance((Object[]) result);
            } else {
                return null;
            }
        } else {
            return query.getSingleResult();
        }
    }
Transforms results using FactoryExpression if ResultTransformer can't be used

@param query query
@return single result
querydsl-jpa/src/main/java/com/querydsl/jpa/impl/AbstractJPAQuery.java