docs: private Query createAccessControlledQuery(QueryModel queryModel) {
          Criteria criteria = getCurrentSession().createCriteria(persistentClass);
  
          for (String associationPath : queryModel.getAssociationConditions().keySet()) {
              criteria.createCriteria(associationPath);
          }
  
          CriteriaQueryTranslator criteriaQueryTranslator = new CriteriaQueryTranslator((SessionFactoryImplementor) sessionFactory,
                                                                                        (CriteriaImpl) criteria,
                                                                                        persistentClass.getName(),
                                                                                        CriteriaQueryTranslator.ROOT_SQL_ALIAS);
  
          StringBuilder queryStringBuilder = new StringBuilder();
  
          buildSelectClause(queryStringBuilder, criteriaQueryTranslator, queryModel.getAssociationConditions().keySet());
  
          List<TypedValue> parameters = buildWhereClause(queryStringBuilder, queryModel, criteria, criteriaQueryTranslator);
  
          if ((queryModel.getAssociationConditions() == null || queryModel.getAssociationConditions().isEmpty())
              && (queryModel.getSorts() == null || queryModel.getSorts().isEmpty())) {
              buildDefaultOrderClause(queryStringBuilder);
          } else {
              // can't use the default ordering by "ace.id" because of "select distinct..." syntax
              buildOrderClause(queryStringBuilder, queryModel, criteria, criteriaQueryTranslator);
          }
  
          Query query = getCurrentSession().createQuery(queryStringBuilder.toString());
  
          setParameters(parameters, query, queryModel.getAccessControlContext());
  
          return query;
      }