public static <RT> Expression<RT> convertForNativeQuery(Expression<RT> expr) {
        if (isEntityPathAndNeedsWrapping(expr)) {
            return ExpressionUtils.operation(expr.getType(), SQLOps.ALL, expr);
        } else if (Number.class.isAssignableFrom(expr.getType())) {
            return new NumberConversion<RT>(expr);
        } else if (Enum.class.isAssignableFrom(expr.getType())) {
            return new EnumConversion<RT>(expr);
        } else if (expr instanceof FactoryExpression) {
            FactoryExpression<RT> factoryExpr = (FactoryExpression<RT>) expr;
            boolean numberConversions = false;
            boolean hasEntityPath = false;
            for (Expression<?> e : factoryExpr.getArgs()) {
                if (isEntityPathAndNeedsWrapping(e)) {
                    hasEntityPath = true;
                } else if (Number.class.isAssignableFrom(e.getType())) {
                    numberConversions = true;
                } else if (Enum.class.isAssignableFrom(e.getType())) {
                    numberConversions = true;
                }
            }
            if (hasEntityPath) {
                factoryExpr = createEntityPathConversions(factoryExpr);
            }
            if (numberConversions) {
                factoryExpr = new NumberConversions<RT>(factoryExpr);
            }
            return factoryExpr;
        }
        return expr;
    }
{@code Conversions} provides module specific projection conversion functionality

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