Creates a new TypedQuery that queries the amount of entities of the entity class of this QueryFactory, that a
query for the given Filter would return.

@param filter the filter
@return a query
166472
public TypedQuery<Long> count(Filter filter) {
        CriteriaQuery<Long> query = cb.createQuery(Long.class);
        Root<T> from = query.from(getEntityClass());

        if (filter != null) {
            Predicate where = new CriteriaMapper(from, cb).create(filter);
            query.where(where);
        }

        return getEntityManager().createQuery(query.select(cb.count(from)));
    }
1040706
public static QueryByCriteria newQuery(Class classToSearchFrom, Criteria criteria)
    {
        return newQuery(classToSearchFrom, criteria, false);
    }
805786
public TypeReferenceAdjustment filter(ElementMatcher<? super TypeDescription> filter) {
        return new TypeReferenceAdjustment(strict, this.filter.<TypeDescription>or(filter));
    }
1019918
public QueryResults<Entity> newEntityQuery(String kind) {
    // [START newEntityQuery]
    Query<Entity> query = Query.newEntityQueryBuilder().setKind(kind).build();
    QueryResults<Entity> results = datastore.run(query);
    // Use results
    // [END newEntityQuery]
    return results;
  }
996593
private org.hibernate.Query query(String hql, Class<?>... type)
  {
    org.hibernate.Query q = session.createQuery(hql);
    for(int i = 0; i < positionedParameters.length; i++) {
      q.setParameter(i, positionedParameters[i]);
    }
    for(Map.Entry<String, Object> entry : namedParameters.entrySet()) {
      Object value = entry.getValue();
      if(Types.isArray(value)) {
        Object[] parameter = (Object[])value;
        if(parameter.length == 0) {
          throw new HibernateException(String.format("Invalid named parameter |%s|. Empty array.", entry.getKey()));
        }
        q.setParameterList(entry.getKey(), parameter);
      }
      else if(Types.isCollection(value)) {
        Collection<?> parameter = (Collection<?>)value;
        if(parameter.isEmpty()) {
          throw new HibernateException(String.format("Invalid named parameter |%s|. Empty list.", entry.getKey()));
        }
        q.setParameterList(entry.getKey(), parameter);
      }
      else {
        q.setParameter(entry.getKey(), value);
      }
    }
    if(offset > 0) {
      q.setFirstResult(offset);
    }
    if(rowsCount > 0) {
      q.setMaxResults(rowsCount);
    }

    if(type.length > 0) {
      q.setResultTransformer(Transformers.aliasToBean(type[0]));
    }
    return q;
  }
248534
@Override
    public <T> Query<T> createQuery(Class<T> entityType, String eql) {
        Assert.notNull(entityType, "entityType must not null");
        Assert.hasText(eql, "eql must has text");
        return ebeanServer.createQuery(entityType, eql);
    }
964985
@Override
    public <T> Query<T> createQuery(Class<T> entityType) {
        Assert.notNull(entityType, "entityType must not null");
        return ebeanServer.find(entityType);
    }
669960
public FilterBuilder<T> addWithAnd(final Filter<T> filter) {
    filterInstance = ComposableFilter.and(filterInstance, filter);
    return this;
  }
680501
public static <T> List<T> filter(Collection<T> c, Filter<T> filter){
        if(c.size()==0)
            return Collections.emptyList();

        List<T> filteredList = new ArrayList<T>(c.size());
        for(T element: c){
            if(filter.select(element))
                filteredList.add(element);
        }
        return filteredList;
    }
23225
@Override
    public <T> Query<T> createQuery(Class<T> entityType, Object queryObject) {
        Assert.notNull(entityType, "entityType must not null");
        Assert.notNull(queryObject, "queryObject must not null");
        return query(entityType, queryObject);
    }
1353457
private Filter createFilter() {
    return new FilterList(FilterList.Operator.MUST_PASS_ONE, processedStateFilter, new SingleColumnValueFilter(
      QueueEntryRow.COLUMN_FAMILY, stateColumnName, CompareFilter.CompareOp.GREATER,
      new BinaryPrefixComparator(Bytes.toBytes(transaction.getReadPointer()))
    ));
  }
929511
private <T> TypedQuery<T> onTypedQuery(Class<T> paramClass, Query q)
    {
        if (paramClass.equals(((QueryImpl) q).getKunderaQuery().getEntityClass()) || paramClass.equals(Object.class))
        {
            return new KunderaTypedQuery<T>(q);
        }

        throw new IllegalArgumentException("Mismatch in expected return type. Expected:" + paramClass
                + " But actual class is:" + ((QueryImpl) q).getKunderaQuery().getEntityClass());
    }
621703
public static QueryBuilder byInstanceId(Object localId, String typeName){
        Validate.argumentsAreNotNull(localId, typeName);
        return new QueryBuilder(new IdAndTypeNameFilterDefinition(localId, typeName));
    }
825976
@Override
    public T findOne(EntityFilter<T> filter) {
        for (T object : findAll()) {
            if (filter.accept(object)) {
                return object;
            }
        }
        return null;
    }
157114
Query createQuery(String jpaQuery, final String persistenceUnit)
    {
        Client client = getClient(persistenceUnit);
        EntityMetadata metadata = null;
        try
        {
            metadata = KunderaMetadataManager.getMetamodel(kunderaMetadata, client.getPersistenceUnit())
                    .getEntityMetadataMap().values().iterator().next();
        }
        catch (Exception e)
        {
            log.info("Entity metadata is null. Proceeding as Scalar Query.");
        }

        Query query = new QueryResolver().getQueryImplementation(jpaQuery, getClient(persistenceUnit)
                .getQueryImplementor(), this, metadata, persistenceUnit);
        return query;
    }
1139506
@Override
  public <T extends Filter> T createFilter(Class<T> classToCreate) throws ServletException {
      
      logger.logp(Level.FINE, CLASS_NAME, "createFilter", "called for class: " + classToCreate);
      return super.createFilter(classToCreate);
  }
212175
public Query<S> query(String filter) throws FetchException {
        synchronized (mStringToQuery) {
            Query<S> query = mStringToQuery.get(filter);
            if (query == null) {
                if (filter == null) {
                    throw new IllegalArgumentException("Query filter must not be null");
                }
                query = query(Filter.filterFor(mType, filter), null);
                mStringToQuery.put(filter, query);
            }
            return query;
        }
    }