com.blazebit.persistence.criteria.BlazeSubquery Maven / Gradle / Ivy
/*
* Copyright 2014 - 2021 Blazebit.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.blazebit.persistence.criteria;
import javax.persistence.criteria.CollectionJoin;
import javax.persistence.criteria.Expression;
import javax.persistence.criteria.Join;
import javax.persistence.criteria.ListJoin;
import javax.persistence.criteria.MapJoin;
import javax.persistence.criteria.Order;
import javax.persistence.criteria.ParameterExpression;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import javax.persistence.criteria.SetJoin;
import javax.persistence.criteria.Subquery;
import javax.persistence.metamodel.EntityType;
import java.util.List;
import java.util.Set;
/**
* An extended version of {@link Subquery}.
*
* @param The type of the selection item
* @author Christian Beikov
* @since 1.2.0
*/
public interface BlazeSubquery extends Subquery, BlazeAbstractQuery {
// TODO: think about whether multiselect support makes sense for subqueries
/**
* Like {@link BlazeSubquery#getOrderList()} but returns the subtype {@link BlazeOrder} instead.
*
* @return The list of ordering expressions
*/
public List getBlazeOrderList();
/**
* Return the ordering expressions in order of precedence.
* Returns empty list if no ordering expressions have been
* specified.
* Modifications to the list do not affect the query.
*
* @return the list of ordering expressions
*/
public List getOrderList();
/**
* Specify the ordering expressions that are used to
* order the query results.
* Replaces the previous ordering expressions, if any.
* If no ordering expressions are specified, the previous
* ordering, if any, is simply removed, and results will
* be returned in no particular order.
* The order of the ordering expressions in the list
* determines the precedence, whereby the first element in the
* list has highest precedence.
*
* @param orders zero or more ordering expressions
* @return this for chaining
*/
public BlazeSubquery orderBy(Order... orders);
/**
* Like {@link BlazeSubquery#orderBy(Order...)} but accepts the subtype {@link BlazeOrder}.
*
* @param orders zero or more ordering expressions
* @return this for chaining
*/
public BlazeSubquery orderBy(BlazeOrder... orders);
/**
* Specify the ordering expressions that are used to
* order the query results.
* Replaces the previous ordering expressions, if any.
* If no ordering expressions are specified, the previous
* ordering, if any, is simply removed, and results will
* be returned in no particular order.
* The order of the ordering expressions in the list
* determines the precedence, whereby the first element in the
* list has highest precedence.
*
* @param orderList list of zero or more ordering expressions
* @return this for chaining
*/
public BlazeSubquery orderBy(List orderList);
/**
* Returns the parameters defined on this query.
*
* @return The parameters
*/
public Set> getParameters();
/* Compatibility for JPA 2.1 */
/**
* Returns the query (which may be a CriteriaQuery, CriteriaUpdate, CriteriaDelete, or a Subquery) of which this is a subquery.
*
* @return The enclosing query or subquery
*/
public BlazeCommonAbstractCriteria getContainingQuery();
/* Covariant overrides */
@Override
public BlazeSubquery select(Expression expression);
@Override
public BlazeSubquery where(Expression restriction);
@Override
public BlazeSubquery where(Predicate... restrictions);
@Override
public BlazeSubquery groupBy(Expression... grouping);
@Override
public BlazeSubquery groupBy(List> grouping);
@Override
public BlazeSubquery having(Expression restriction);
@Override
public BlazeSubquery having(Predicate... restrictions);
@Override
public BlazeSubquery distinct(boolean distinct);
@Override
public BlazeRoot correlate(Root parentRoot);
@Override
public BlazeJoin correlate(Join parentJoin);
@Override
public BlazeCollectionJoin correlate(CollectionJoin parentCollection);
@Override
public BlazeSetJoin correlate(SetJoin parentSet);
@Override
public BlazeListJoin correlate(ListJoin parentList);
@Override
public BlazeMapJoin correlate(MapJoin parentMap);
@Override
public BlazeAbstractQuery getParent();
@Override
public BlazeRoot from(Class entityClass);
@Override
public BlazeRoot from(EntityType entity);
@Override
public BlazeSubquery subquery(Class type);
}