com.blazebit.persistence.criteria.BlazeAbstractQuery Maven / Gradle / Ivy
/*
* Copyright 2014 - 2020 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.AbstractQuery;
import javax.persistence.criteria.Expression;
import javax.persistence.criteria.Predicate;
import javax.persistence.metamodel.EntityType;
import java.util.List;
import java.util.Set;
/**
* An extended version of {@link AbstractQuery} that allows setting an alias for {@link javax.persistence.criteria.From} elements.
*
* @param the type of the result
* @author Christian Beikov
* @since 1.2.0
*/
public interface BlazeAbstractQuery extends AbstractQuery, BlazeCommonAbstractCriteria {
// TODO: create a fluent builder for clauses, maybe via RestrictionBuilder?
// TODO: integrate support for SetBuilder, CteBuilder
// TODO: integrate support for default join nodes?
// TODO: maybe add explicit support for limit?
/**
* Like {@link AbstractQuery#from(Class)} but allows to set the alias of the {@link BlazeRoot}.
*
* @param entityClass the entity class
* @param alias The alias for the {@link BlazeRoot}
* @param The entity type
* @return query root corresponding to the given entity
*/
public BlazeRoot from(Class entityClass, String alias);
/**
* Like {@link AbstractQuery#from(EntityType)} but allows to set the alias of the {@link BlazeRoot}.
*
* @param entityType the entity type
* @param alias The alias for the {@link BlazeRoot}
* @param The entity type
* @return query root corresponding to the given entity
*/
public BlazeRoot from(EntityType entityType, String alias);
/**
* Like {@link AbstractQuery#getRoots()} but returns the subtype {@link BlazeRoot} instead.
*
* @return the set of query roots
*/
public Set> getBlazeRoots();
/* Covariant overrides */
@Override
BlazeRoot from(Class entityClass);
@Override
BlazeRoot from(EntityType entity);
@Override
BlazeAbstractQuery where(Expression restriction);
@Override
BlazeAbstractQuery where(Predicate... restrictions);
@Override
BlazeAbstractQuery groupBy(Expression... grouping);
@Override
BlazeAbstractQuery groupBy(List> grouping);
@Override
BlazeAbstractQuery having(Expression restriction);
@Override
BlazeAbstractQuery having(Predicate... restrictions);
@Override
BlazeAbstractQuery distinct(boolean distinct);
}