public <T> PagedList<T> getPaginatedCats(EntityViewSetting<T, PaginatedCriteriaBuilder<T>> setting) { CriteriaBuilder<Cat> cb = cbf.create(emHolder.getEntityManager(), Cat.class) .orderByAsc("name") .orderByAsc("id"); return evm.applySetting(setting, cb).withKeysetExtraction(true).getResultList(); } }
public <T> PagedList<T> getPaginatedCats(EntityViewSetting<T, PaginatedCriteriaBuilder<T>> setting) { CriteriaBuilder<Cat> cb = cbf.create(emHolder.getEntityManager(), Cat.class) .orderByAsc("name") .orderByAsc("id"); return evm.applySetting(setting, cb).withKeysetExtraction(true).getResultList(); } }
public <T> PagedList<T> getPaginatedCats(EntityViewSetting<T, PaginatedCriteriaBuilder<T>> setting) { CriteriaBuilder<Cat> cb = cbf.create(emHolder.getEntityManager(), Cat.class) .orderByAsc("name") .orderByAsc("id"); return evm.applySetting(setting, cb).withKeysetExtraction(true).getResultList(); } }
public <T> PagedList<T> getPaginatedCats(EntityViewSetting<T, PaginatedCriteriaBuilder<T>> setting) { CriteriaBuilder<Cat> cb = cbf.create(emHolder.getEntityManager(), Cat.class) .orderByAsc("name") .orderByAsc("id"); return evm.applySetting(setting, cb).withKeysetExtraction(true).getResultList(); } }
public <T> PagedList<T> getPaginatedCats(EntityViewSetting<T, PaginatedCriteriaBuilder<T>> setting) { CriteriaBuilder<Cat> cb = cbf.create(emHolder.getEntityManager(), Cat.class) .orderByAsc("name") .orderByAsc("id"); return evm.applySetting(setting, cb).withKeysetExtraction(true).getResultList(); } }
public <T> PagedList<T> getPaginatedCats(EntityViewSetting<T, PaginatedCriteriaBuilder<T>> setting) { CriteriaBuilder<Cat> cb = cbf.create(emHolder.getEntityManager(), Cat.class) .orderByAsc("name") .orderByAsc("id"); return evm.applySetting(setting, cb).withKeysetExtraction(true).getResultList(); } }
public void buildQuery(CriteriaBuilder<?> cb) { switch (direction) { case DESC: cb.orderByDesc(EntityViewBasePropertyQueryPart.rewriteSeparator(attribute)); break; case DEFAULT: case ASC: default: cb.orderByAsc(EntityViewBasePropertyQueryPart.rewriteSeparator(attribute)); break; } }
void buildQuery(CriteriaBuilder<?> cb) { switch (direction) { case DESC: cb.orderByDesc(EntityViewBasePropertyQueryPart.rewriteSeparator(attribute)); break; case DEFAULT: case ASC: default: cb.orderByAsc(EntityViewBasePropertyQueryPart.rewriteSeparator(attribute)); break; } }
@Override public List<V> findAll(int start, int max) { CriteriaBuilder<E> cb = createCriteriaBuilder().orderByAsc(idAttribute()); String[] fetches = getFetches(); if (fetches.length != 0) { cb.fetch(fetches); } TypedQuery<V> query; if (viewClass() == null) { query = (TypedQuery<V>) cb.getQuery(); } else { EntityViewSetting<V, PaginatedCriteriaBuilder<V>> setting = EntityViewSetting.create(viewClass(), start, max); query = applySetting(setting, cb) .getQuery(); } applyQueryHints(query, fetches.length == 0); return query.getResultList(); }
cb.orderByAsc(idAttribute());
public <T> List<T> getCatHierarchy(Integer catId, EntityViewSetting<T, CriteriaBuilder<T>> setting) { CriteriaBuilder<Tuple> cb = cbf.create(emHolder.getEntityManager(), Tuple.class) .withRecursive(CatHierarchyCTE.class) .from(Cat.class) .bind("id").select("id") .bind("motherId").select("mother.id") .bind("fatherId").select("father.id") .bind("generation").select("0") .where("id").eqExpression(catId.toString()) .unionAll() .from(Cat.class, "cat") .from(CatHierarchyCTE.class, "cte") .bind("id").select("cat.id") .bind("motherId").select("cat.mother.id") .bind("fatherId").select("cat.father.id") .bind("generation").select("cte.generation + 1") .whereOr() .where("cat.id").eqExpression("cte.motherId") .where("cat.id").eqExpression("cte.fatherId") .endOr() .end() .from(Cat.class, "cat") .innerJoinOn(CatHierarchyCTE.class, "cte").on("cte.id").eqExpression("cat.id").end() .orderByAsc("cte.generation"); return evm.applySetting(setting, cb).getResultList(); }
public <T> List<T> getCatHierarchy(Integer catId, EntityViewSetting<T, CriteriaBuilder<T>> setting) { CriteriaBuilder<Tuple> cb = cbf.create(emHolder.getEntityManager(), Tuple.class) .withRecursive(CatHierarchyCTE.class) .from(Cat.class) .bind("id").select("id") .bind("motherId").select("mother.id") .bind("fatherId").select("father.id") .bind("generation").select("0") .where("id").eqExpression(catId.toString()) .unionAll() .from(Cat.class, "cat") .from(CatHierarchyCTE.class, "cte") .bind("id").select("cat.id") .bind("motherId").select("cat.mother.id") .bind("fatherId").select("cat.father.id") .bind("generation").select("cte.generation + 1") .whereOr() .where("cat.id").eqExpression("cte.motherId") .where("cat.id").eqExpression("cte.fatherId") .endOr() .end() .from(Cat.class, "cat") .innerJoinOn(CatHierarchyCTE.class, "cte").on("cte.id").eqExpression("cat.id").end() .orderByAsc("cte.generation"); return evm.applySetting(setting, cb).getResultList(); }
public <T> List<T> getCatHierarchy(Integer catId, EntityViewSetting<T, CriteriaBuilder<T>> setting) { CriteriaBuilder<Tuple> cb = cbf.create(emHolder.getEntityManager(), Tuple.class) .withRecursive(CatHierarchyCTE.class) .from(Cat.class) .bind("id").select("id") .bind("motherId").select("mother.id") .bind("fatherId").select("father.id") .bind("generation").select("0") .where("id").eqExpression(catId.toString()) .unionAll() .from(Cat.class, "cat") .from(CatHierarchyCTE.class, "cte") .bind("id").select("cat.id") .bind("motherId").select("cat.mother.id") .bind("fatherId").select("cat.father.id") .bind("generation").select("cte.generation + 1") .whereOr() .where("cat.id").eqExpression("cte.motherId") .where("cat.id").eqExpression("cte.fatherId") .endOr() .end() .from(Cat.class, "cat") .innerJoinOn(CatHierarchyCTE.class, "cte").on("cte.id").eqExpression("cat.id").end() .orderByAsc("cte.generation"); return evm.applySetting(setting, cb).getResultList(); }