queryMixin.addProjection(args);
return createQuery(getMetadata().getModifiers(), false);
}
private Query createQuery(@Nullable QueryModifiers modifiers, boolean forCount) {
JPQLSerializer serializer = serialize(forCount);
String queryString = serializer.toString();
logQuery(queryString);
Query query = entityManager.createQuery(queryString);
JPAUtil.setConstants(query, serializer.getConstantToLabel(), getMetadata().getParams());
if (modifiers != null && modifiers.isRestricting()) {
Integer limit = modifiers.getLimitAsInteger();
Integer offset = modifiers.getOffsetAsInteger();
if (limit != null) {
query.setMaxResults(limit.intValue());