@Override public void addOrderings(Collection<? extends Ordering> orderings) { query.addOrderings(orderings); }
/** * @since 4.0 */ public static SelectQuery<DataRow> dataRowQuery(Class<?> rootClass, Expression qualifier, List<Ordering> orderings) { SelectQuery<DataRow> query = dataRowQuery(rootClass, qualifier); query.addOrderings(orderings); return query; }
/** * Creates a SelectQuery that selects objects of a given persistent class * that match supplied qualifier. * * @param rootClass * the Class of objects fetched by this query. * @param qualifier * an Expression indicating which objects should be fetched. * @param orderings * defines how to order the results, may be null. * @since 3.1 */ public SelectQuery(Class<T> rootClass, Expression qualifier, List<? extends Ordering> orderings) { init(rootClass, qualifier); addOrderings(orderings); }
/** * Creates a SelectQuery that selects objects of a given persistent class * that match supplied qualifier. * * @param objEntityName * the name of the ObjEntity to fetch from. * @param qualifier * an Expression indicating which objects should be fetched. * @param orderings * defines how to order the results, may be null. * @since 3.1 */ public SelectQuery(String objEntityName, Expression qualifier, List<? extends Ordering> orderings) { init(objEntityName, qualifier); addOrderings(orderings); }
/** * Creates a SelectQuery for the specified DbEntity with the given qualifier * and orderings. * * @param root * the DbEntity this SelectQuery is for. * @param qualifier * an Expression indicating which objects should be fetched. * @param orderings * defines how to order the results, may be null. * @since 3.1 */ public SelectQuery(DbEntity root, Expression qualifier, List<? extends Ordering> orderings) { this(); this.init(root, qualifier); addOrderings(orderings); }
/** * Creates a SelectQuery for the specified ObjEntity with the given * qualifier and orderings. * * @param root * the ObjEntity this SelectQuery is for. * @param qualifier * an Expression indicating which objects should be fetched. * @param orderings * defines how to order the results, may be null. * @since 3.1 */ public SelectQuery(ObjEntity root, Expression qualifier, List<? extends Ordering> orderings) { this(); this.init(root, qualifier); addOrderings(orderings); }
/** * Creates a SelectQuery. */ public Query getQuery() { SelectQuery query = new SelectQuery(); query.setRoot(getRoot()); query.setName(name); query.setQualifier(qualifier); if (orderings != null && !orderings.isEmpty()) { query.addOrderings(orderings); } if (prefetches != null && !prefetches.isEmpty()) { Iterator it = prefetches.iterator(); while(it.hasNext()) { query.addPrefetch((String) it.next()); } } // init properties query.initWithProperties(properties); return query; } }
query.addOrderings(orderings);
/** * Returns a query built using this query as a prototype, using a set of * parameters to build the qualifier. * * @see org.apache.cayenne.exp.Expression#expWithParameters(java.util.Map, * boolean) parameter substitution. */ public SelectQuery<T> queryWithParameters(Map<String, ?> parameters, boolean pruneMissing) { // create a query replica SelectQuery<T> query = new SelectQuery<T>(); query.setDistinct(distinct); query.metaData.copyFromInfo(this.metaData); query.setRoot(root); if (orderings != null) { query.addOrderings(orderings); } // substitute qualifier parameters if (qualifier != null) { query.setQualifier(qualifier.params(parameters, pruneMissing)); } return query; }
@Override public SelectQuery<?> buildQuery() { SelectQuery<Object> selectQuery = new SelectQuery<>(); selectQuery.setRoot(this.getRoot()); selectQuery.setName(this.getName()); selectQuery.setDataMap(dataMap); selectQuery.setQualifier(this.getQualifier()); List<Ordering> orderings = this.getOrderings(); if (orderings != null && !orderings.isEmpty()) { selectQuery.addOrderings(orderings); } List<String> prefetches = this.getPrefetches(); if (prefetches != null && !prefetches.isEmpty()) { for (String prefetch : prefetches) { selectQuery.addPrefetch(prefetch); } } // init properties selectQuery.initWithProperties(this.getProperties()); return selectQuery; }
replacement.addOrderings(orderings); replacement.setPrefetchTree(prefetches); replacement.setCacheStrategy(cacheStrategy);