@Override
    public JPAQuery<?> query() {
        if (templates != null) {
            return new JPAQuery<Void>(entityManager.get(), templates);
        } else {
            return new JPAQuery<Void>(entityManager.get());
        }
    }
Factory class for query and DML clause creation

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