Interface BlazeCriteriaBuilder
- All Superinterfaces:
CriteriaBuilder
An extended version of
CriteriaBuilder.- Since:
- 1.2.0
- Author:
- Christian Beikov
-
Nested Class Summary
Nested classes/interfaces inherited from interface javax.persistence.criteria.CriteriaBuilder
CriteriaBuilder.Case<R extends Object>, CriteriaBuilder.Coalesce<T extends Object>, CriteriaBuilder.In<T extends Object>, CriteriaBuilder.SimpleCase<C extends Object,R extends Object>, CriteriaBuilder.Trimspec -
Method Summary
Modifier and TypeMethodDescriptionaggregateDistinctFunction(String name, Class<T> type, Expression<?>... args) Creates an aggregate function expression for a function with the given name, result type and arguments aggregating only distinct elements.aggregateFunction(String name, Class<T> type, Expression<?>... args) Creates an aggregate function expression for a function with the given name, result type and arguments.asc(Expression<?> x) asc(Expression<?> x, boolean nullsFirst) LikeCriteriaBuilder.asc(Expression)but allows to also specify the null precedence.<N extends Number>
BlazeAggregateFunctionExpression<Double>avg(Expression<N> x) Creates anAVGaggregate function expression.count(Expression<?> x) Creates aCOUNTaggregate function expression.countDistinct(Expression<?> x) Creates aCOUNTaggregate function expression which only counts distinct elements.<T> BlazeCriteriaDelete<T>createCriteriaDelete(Class<T> targetEntity) Create a query object to perform a bulk delete operation.<T> BlazeCriteriaDelete<T>createCriteriaDelete(Class<T> targetEntity, String alias) LikecreateCriteriaDelete(Class)but also sets the alias for the entity.<T> BlazeCriteriaUpdate<T>createCriteriaUpdate(Class<T> targetEntity) Create a query object to perform a bulk update operation.<T> BlazeCriteriaUpdate<T>createCriteriaUpdate(Class<T> targetEntity, String alias) LikecreateCriteriaUpdate(Class)but also sets the alias for the entity.<T> BlazeCriteriaQuery<T>createQuery(Class<T> resultClass) cumeDist(Expression<?> expression) Creates aCUME_DISTwindow function expression.denseRank(Expression<?> expression) Creates aDENSE_RANKwindow function expression.desc(Expression<?> x) desc(Expression<?> x, boolean nullsFirst) LikeCriteriaBuilder.desc(Expression)but allows to also specify the null precedence.firstValue(Expression<X> expression) Creates aFIRST_VALUEwindow function expression.<T> BlazeFunctionExpression<T>function(String name, Class<T> type, Expression<?>... args) Creates a function expression for a function with the given name, result type and arguments.<X extends Comparable<? super X>>
BlazeAggregateFunctionExpression<X>greatest(Expression<X> x) Creates aMAXaggregate function expression.isMapEmpty(Expression<C> map) Create a predicate that tests whether a map is empty.isMapNotEmpty(Expression<C> map) Create a predicate that tests whether a map is not empty.lag(Expression<X> expression) Creates aLAGwindow function expression.lastValue(Expression<X> expression) Creates aLAST_VALUEwindow function expression.lead(Expression<X> expression) Creates aLEADwindow function expression.<X extends Comparable<? super X>>
BlazeAggregateFunctionExpression<X>least(Expression<X> x) Creates aMINaggregate function expression.listagg(Expression<String> expression, Expression<String> separator) Creates aLISTAGGordered set-aggregate function expression.listaggDistinct(Expression<String> expression, Expression<String> separator) Creates aLISTAGGordered set-aggregate function expression which only aggregates distinct elements.<C extends Map<?,?>>
Expression<Integer>mapSize(C map) Create an expression that tests the size of a map.<C extends Map<?,?>>
Expression<Integer>mapSize(Expression<C> map) Create an expression that tests the size of a map.<N extends Number>
BlazeAggregateFunctionExpression<N>max(Expression<N> x) Creates aMAXaggregate function expression.<N extends Number>
BlazeAggregateFunctionExpression<N>min(Expression<N> x) Creates aMINaggregate function expression.modeWithinGroup(Expression<X> group) Creates aMODEordered set-aggregate function expression.nthValue(Expression<X> expression, Expression<Integer> index) Creates aNTH_VALUEwindow function expression.ntile(Expression<?> expression) Creates aNTILEwindow function expression.orderedSetAggregateDistinctFunction(String name, Class<T> type, Expression<?>... args) Creates an ordered set-aggregate function expression for a function with the given name, result type and arguments aggregating only distinct elements.orderedSetAggregateFunction(String name, Class<T> type, Expression<?>... args) Creates an ordered set-aggregate function expression for a function with the given name, result type and arguments.percentileContWithinGroup(Expression<Double> fraction, Expression<X> group, boolean ascending, boolean nullsFirst) Creates aPERCENTILE_CONTordered set-aggregate function expression.percentileDiscWithinGroup(Expression<Double> fraction, Expression<X> group, boolean ascending, boolean nullsFirst) Creates aPERCENTILE_DISCordered set-aggregate function expression.percentRank(Expression<?> expression) Creates aPERCENT_RANKwindow function expression.rank(Expression<?> expression) Creates aRANKwindow function expression.Creates aROW_NUMBERwindow function expression.<N extends Number>
BlazeAggregateFunctionExpression<N>sum(Expression<N> x) Creates aSUMaggregate function expression.Creates aSUMaggregate function expression that returns a double value.Creates aSUMaggregate function expression that returns a long value.<X,T, E extends T>
BlazeCollectionJoin<X,E> treat(BlazeCollectionJoin<X, T> join, Class<E> type) Downcast CollectionJoin object to the specified type.<X,T, V extends T>
BlazeJoin<X,V> Downcast Join object to the specified type.<X,T, E extends T>
BlazeListJoin<X,E> treat(BlazeListJoin<X, T> join, Class<E> type) Downcast ListJoin object to the specified type.<X,K, T, V extends T>
BlazeMapJoin<X,K, V> treat(BlazeMapJoin<X, K, T> join, Class<V> type) Downcast MapJoin object to the specified type.<X,T extends X>
BlazePath<T>Downcast Path object to the specified type.<X,T extends X>
BlazeRoot<T>Downcast Root object to the specified type.<X,T, E extends T>
BlazeSetJoin<X,E> treat(BlazeSetJoin<X, T> join, Class<E> type) Downcast SetJoin object to the specified type.<X,T, E extends T>
BlazeCollectionJoin<X,E> treat(CollectionJoin<X, T> join, Class<E> type) Downcast CollectionJoin object to the specified type.<X,T, V extends T>
BlazeJoin<X,V> Downcast Join object to the specified type.<X,T, E extends T>
BlazeListJoin<X,E> Downcast ListJoin object to the specified type.<X,K, T, V extends T>
BlazeMapJoin<X,K, V> Downcast MapJoin object to the specified type.<X,T extends X>
BlazePath<T>Downcast Path object to the specified type.<X,T extends X>
BlazeRoot<T>Downcast Root object to the specified type.<X,T, E extends T>
BlazeSetJoin<X,E> Downcast SetJoin object to the specified type.window()Returns a new window to be used with window functions.windowDistinctFunction(String name, Class<T> type, Expression<?>... args) Creates a window function expression for a function with the given name, result type and arguments aggregating only distinct elements.windowFunction(String name, Class<T> type, Expression<?>... args) Creates a window function expression for a function with the given name, result type and arguments.Methods inherited from interface javax.persistence.criteria.CriteriaBuilder
abs, all, and, and, any, array, between, between, coalesce, coalesce, coalesce, concat, concat, concat, conjunction, construct, currentDate, currentTime, currentTimestamp, diff, diff, diff, disjunction, equal, equal, exists, ge, ge, greaterThan, greaterThan, greaterThanOrEqualTo, greaterThanOrEqualTo, gt, gt, in, isEmpty, isFalse, isMember, isMember, isNotEmpty, isNotMember, isNotMember, isNotNull, isNull, isTrue, keys, le, le, length, lessThan, lessThan, lessThanOrEqualTo, lessThanOrEqualTo, like, like, like, like, like, like, literal, locate, locate, locate, locate, lower, lt, lt, mod, mod, mod, neg, not, notEqual, notEqual, notLike, notLike, notLike, notLike, notLike, notLike, nullif, nullif, nullLiteral, or, or, parameter, parameter, prod, prod, prod, quot, quot, quot, selectCase, selectCase, size, size, some, sqrt, substring, substring, substring, substring, sum, sum, sum, toBigDecimal, toBigInteger, toDouble, toFloat, toInteger, toLong, toString, trim, trim, trim, trim, trim, trim, tuple, upper, values
-
Method Details
-
isMapEmpty
Create a predicate that tests whether a map is empty.- Type Parameters:
C- map type- Parameters:
map- expression- Returns:
- is-empty predicate
-
isMapNotEmpty
Create a predicate that tests whether a map is not empty.- Type Parameters:
C- map type- Parameters:
map- expression- Returns:
- is-not-empty predicate
-
mapSize
Create an expression that tests the size of a map.- Type Parameters:
C- map type- Parameters:
map- map- Returns:
- size expression
-
mapSize
Create an expression that tests the size of a map.- Type Parameters:
C- map type- Parameters:
map- map- Returns:
- size expression
-
asc
LikeCriteriaBuilder.asc(Expression)but allows to also specify the null precedence.- Parameters:
x- The expression used to define the orderingnullsFirst- True if nulls should be first, false otherwise- Returns:
- ascending ordering corresponding to the expression
-
desc
LikeCriteriaBuilder.desc(Expression)but allows to also specify the null precedence.- Parameters:
x- The expression used to define the orderingnullsFirst- True if nulls should be first, false otherwise- Returns:
- descending ordering corresponding to the expression
-
createCriteriaUpdate
LikecreateCriteriaUpdate(Class)but also sets the alias for the entity.- Type Parameters:
T- The type of the entity- Parameters:
targetEntity- target type for update operationalias- The alias for the entity- Returns:
- the query object
-
createCriteriaDelete
LikecreateCriteriaDelete(Class)but also sets the alias for the entity.- Type Parameters:
T- The type of the entity- Parameters:
targetEntity- target type for delete operationalias- The alias for the entity- Returns:
- the query object
-
asc
- Specified by:
ascin interfaceCriteriaBuilder
-
desc
- Specified by:
descin interfaceCriteriaBuilder
-
createQuery
BlazeCriteriaQuery<Object> createQuery()- Specified by:
createQueryin interfaceCriteriaBuilder
-
createQuery
- Specified by:
createQueryin interfaceCriteriaBuilder
-
createTupleQuery
BlazeCriteriaQuery<Tuple> createTupleQuery()- Specified by:
createTupleQueryin interfaceCriteriaBuilder
-
createCriteriaUpdate
Create a query object to perform a bulk update operation.- Type Parameters:
T- The type of the entity- Parameters:
targetEntity- target type for update operation- Returns:
- the query object
-
createCriteriaDelete
Create a query object to perform a bulk delete operation.- Type Parameters:
T- The type of the entity- Parameters:
targetEntity- target type for delete operation- Returns:
- the query object
-
treat
Downcast Join object to the specified type.- Type Parameters:
X- The source typeT- The type of the joined relationV- The target treat type- Parameters:
join- Join objecttype- type to be downcast to- Returns:
- Join object of the specified type
-
treat
Downcast CollectionJoin object to the specified type.- Type Parameters:
X- The source typeT- The type of the joined relationE- The target treat type- Parameters:
join- CollectionJoin objecttype- type to be downcast to- Returns:
- CollectionJoin object of the specified type
-
treat
Downcast SetJoin object to the specified type.- Type Parameters:
X- The source typeT- The type of the joined relationE- The target treat type- Parameters:
join- SetJoin objecttype- type to be downcast to- Returns:
- SetJoin object of the specified type
-
treat
Downcast ListJoin object to the specified type.- Type Parameters:
X- The source typeT- The type of the joined relationE- The target treat type- Parameters:
join- ListJoin objecttype- type to be downcast to- Returns:
- ListJoin object of the specified type
-
treat
Downcast MapJoin object to the specified type.- Type Parameters:
X- The source typeT- The type of the joined relationK- The key type of the joined relationV- The target treat type- Parameters:
join- MapJoin objecttype- type to be downcast to- Returns:
- MapJoin object of the specified type
-
treat
Downcast Path object to the specified type.- Type Parameters:
X- The path typeT- The target treat type- Parameters:
path- pathtype- type to be downcast to- Returns:
- Path object of the specified type
-
treat
Downcast Root object to the specified type.- Type Parameters:
X- The root typeT- The target treat type- Parameters:
root- roottype- type to be downcast to- Returns:
- Path object of the specified type
-
treat
Downcast Join object to the specified type.- Type Parameters:
X- The source typeT- The type of the joined relationV- The target treat type- Parameters:
join- Join objecttype- type to be downcast to- Returns:
- Join object of the specified type
-
treat
Downcast CollectionJoin object to the specified type.- Type Parameters:
X- The source typeT- The type of the joined relationE- The target treat type- Parameters:
join- CollectionJoin objecttype- type to be downcast to- Returns:
- CollectionJoin object of the specified type
-
treat
Downcast SetJoin object to the specified type.- Type Parameters:
X- The source typeT- The type of the joined relationE- The target treat type- Parameters:
join- SetJoin objecttype- type to be downcast to- Returns:
- SetJoin object of the specified type
-
treat
Downcast ListJoin object to the specified type.- Type Parameters:
X- The source typeT- The type of the joined relationE- The target treat type- Parameters:
join- ListJoin objecttype- type to be downcast to- Returns:
- ListJoin object of the specified type
-
treat
Downcast MapJoin object to the specified type.- Type Parameters:
X- The source typeT- The type of the joined relationK- The key type of the joined relationV- The target treat type- Parameters:
join- MapJoin objecttype- type to be downcast to- Returns:
- MapJoin object of the specified type
-
treat
Downcast Path object to the specified type.- Type Parameters:
X- The path typeT- The target treat type- Parameters:
path- pathtype- type to be downcast to- Returns:
- Path object of the specified type
-
treat
Downcast Root object to the specified type.- Type Parameters:
X- The root typeT- The target treat type- Parameters:
root- roottype- type to be downcast to- Returns:
- Path object of the specified type
-
window
BlazeWindow window()Returns a new window to be used with window functions.- Returns:
- the new window
-
function
Creates a function expression for a function with the given name, result type and arguments.- Specified by:
functionin interfaceCriteriaBuilder- Type Parameters:
T- the result type- Parameters:
name- the name of the functiontype- the result type of functionargs- the arguments for the function- Returns:
- the function expression
-
windowFunction
<T> BlazeWindowFunctionExpression<T> windowFunction(String name, Class<T> type, Expression<?>... args) Creates a window function expression for a function with the given name, result type and arguments.- Type Parameters:
T- the result type- Parameters:
name- the name of the functiontype- the result type of functionargs- the arguments for the function- Returns:
- the window function expression
-
windowDistinctFunction
<T> BlazeWindowFunctionExpression<T> windowDistinctFunction(String name, Class<T> type, Expression<?>... args) Creates a window function expression for a function with the given name, result type and arguments aggregating only distinct elements.- Type Parameters:
T- the result type- Parameters:
name- the name of the functiontype- the result type of functionargs- the arguments for the function- Returns:
- the window function expression
-
aggregateFunction
<T> BlazeAggregateFunctionExpression<T> aggregateFunction(String name, Class<T> type, Expression<?>... args) Creates an aggregate function expression for a function with the given name, result type and arguments.- Type Parameters:
T- the result type- Parameters:
name- the name of the functiontype- the result type of functionargs- the arguments for the function- Returns:
- the aggregate function expression
-
aggregateDistinctFunction
<T> BlazeAggregateFunctionExpression<T> aggregateDistinctFunction(String name, Class<T> type, Expression<?>... args) Creates an aggregate function expression for a function with the given name, result type and arguments aggregating only distinct elements.- Type Parameters:
T- the result type- Parameters:
name- the name of the functiontype- the result type of functionargs- the arguments for the function- Returns:
- the aggregate function expression
-
orderedSetAggregateFunction
<T> BlazeOrderedSetAggregateFunctionExpression<T> orderedSetAggregateFunction(String name, Class<T> type, Expression<?>... args) Creates an ordered set-aggregate function expression for a function with the given name, result type and arguments.- Type Parameters:
T- the result type- Parameters:
name- the name of the functiontype- the result type of functionargs- the arguments for the function- Returns:
- the ordered set-aggregate function expression
-
orderedSetAggregateDistinctFunction
<T> BlazeOrderedSetAggregateFunctionExpression<T> orderedSetAggregateDistinctFunction(String name, Class<T> type, Expression<?>... args) Creates an ordered set-aggregate function expression for a function with the given name, result type and arguments aggregating only distinct elements.- Type Parameters:
T- the result type- Parameters:
name- the name of the functiontype- the result type of functionargs- the arguments for the function- Returns:
- the ordered set-aggregate function expression
-
avg
Creates anAVGaggregate function expression.- Specified by:
avgin interfaceCriteriaBuilder- Type Parameters:
N- The number type- Parameters:
x- the argument to aggregate- Returns:
- the aggregate function expression
-
sum
Creates aSUMaggregate function expression.- Specified by:
sumin interfaceCriteriaBuilder- Type Parameters:
N- The number type- Parameters:
x- the argument to aggregate- Returns:
- the aggregate function expression
-
sumAsLong
Creates aSUMaggregate function expression that returns a long value.- Specified by:
sumAsLongin interfaceCriteriaBuilder- Parameters:
x- the argument to aggregate- Returns:
- the aggregate function expression
-
sumAsDouble
Creates aSUMaggregate function expression that returns a double value.- Specified by:
sumAsDoublein interfaceCriteriaBuilder- Parameters:
x- the argument to aggregate- Returns:
- the aggregate function expression
-
max
Creates aMAXaggregate function expression.- Specified by:
maxin interfaceCriteriaBuilder- Type Parameters:
N- The number type- Parameters:
x- the argument to aggregate- Returns:
- the aggregate function expression
-
min
Creates aMINaggregate function expression.- Specified by:
minin interfaceCriteriaBuilder- Type Parameters:
N- The number type- Parameters:
x- the argument to aggregate- Returns:
- the aggregate function expression
-
greatest
Creates aMAXaggregate function expression.- Specified by:
greatestin interfaceCriteriaBuilder- Type Parameters:
X- The argument type- Parameters:
x- the argument to aggregate- Returns:
- the aggregate function expression
-
least
Creates aMINaggregate function expression.- Specified by:
leastin interfaceCriteriaBuilder- Type Parameters:
X- The argument type- Parameters:
x- the argument to aggregate- Returns:
- the aggregate function expression
-
count
Creates aCOUNTaggregate function expression.- Specified by:
countin interfaceCriteriaBuilder- Parameters:
x- the argument to use for determining whether to count- Returns:
- the aggregate function expression
-
countDistinct
Creates aCOUNTaggregate function expression which only counts distinct elements.- Specified by:
countDistinctin interfaceCriteriaBuilder- Parameters:
x- the argument to use for determining whether to count- Returns:
- the aggregate function expression
-
rowNumber
BlazeWindowFunctionExpression<Integer> rowNumber()Creates aROW_NUMBERwindow function expression.- Returns:
- the window function expression
-
rank
Creates aRANKwindow function expression.- Parameters:
expression- the expression for which to apply the window function to- Returns:
- the window function expression
-
denseRank
Creates aDENSE_RANKwindow function expression.- Parameters:
expression- the expression for which to apply the window function to- Returns:
- the window function expression
-
percentRank
Creates aPERCENT_RANKwindow function expression.- Parameters:
expression- the expression for which to apply the window function to- Returns:
- the window function expression
-
cumeDist
Creates aCUME_DISTwindow function expression.- Parameters:
expression- the expression for which to apply the window function to- Returns:
- the window function expression
-
ntile
Creates aNTILEwindow function expression.- Parameters:
expression- the expression for which to apply the window function to- Returns:
- the window function expression
-
lead
Creates aLEADwindow function expression.- Type Parameters:
X- The expression type- Parameters:
expression- the expression for which to apply the window function to- Returns:
- the window function expression
-
lag
Creates aLAGwindow function expression.- Type Parameters:
X- The expression type- Parameters:
expression- the expression for which to apply the window function to- Returns:
- the window function expression
-
firstValue
Creates aFIRST_VALUEwindow function expression.- Type Parameters:
X- The expression type- Parameters:
expression- the expression for which to apply the window function to- Returns:
- the window function expression
-
lastValue
Creates aLAST_VALUEwindow function expression.- Type Parameters:
X- The expression type- Parameters:
expression- the expression for which to apply the window function to- Returns:
- the window function expression
-
nthValue
Creates aNTH_VALUEwindow function expression.- Type Parameters:
X- The expression type- Parameters:
expression- the expression for which to apply the window function toindex- the index of the value relative to the frame start- Returns:
- the window function expression
-
percentileContWithinGroup
<X> BlazeOrderedSetAggregateFunctionExpression<X> percentileContWithinGroup(Expression<Double> fraction, Expression<X> group, boolean ascending, boolean nullsFirst) Creates aPERCENTILE_CONTordered set-aggregate function expression.- Type Parameters:
X- The expression type- Parameters:
fraction- the fraction of the ordering for which to return a value forgroup- the group within which to determine the percentileascending- Whether to sort by group ascending or descendingnullsFirst- Whether to sort nulls of the group first or last- Returns:
- the ordered set-aggregate function expression
-
percentileDiscWithinGroup
<X> BlazeOrderedSetAggregateFunctionExpression<X> percentileDiscWithinGroup(Expression<Double> fraction, Expression<X> group, boolean ascending, boolean nullsFirst) Creates aPERCENTILE_DISCordered set-aggregate function expression.- Type Parameters:
X- The expression type- Parameters:
fraction- the fraction of the ordering for which to return a value forgroup- the group within which to determine the percentileascending- Whether to sort by group ascending or descendingnullsFirst- Whether to sort nulls of the group first or last- Returns:
- the ordered set-aggregate function expression
-
modeWithinGroup
Creates aMODEordered set-aggregate function expression.- Type Parameters:
X- The expression type- Parameters:
group- the group within which to find the mode- Returns:
- the ordered set-aggregate function expression
-
listagg
BlazeOrderedSetAggregateFunctionExpression<String> listagg(Expression<String> expression, Expression<String> separator) Creates aLISTAGGordered set-aggregate function expression.- Parameters:
expression- the argument to list aggregateseparator- the separator to put between elements in the aggregation- Returns:
- the ordered set-aggregate function expression
-
listaggDistinct
BlazeOrderedSetAggregateFunctionExpression<String> listaggDistinct(Expression<String> expression, Expression<String> separator) Creates aLISTAGGordered set-aggregate function expression which only aggregates distinct elements.- Parameters:
expression- the argument to list aggregateseparator- the separator to put between elements in the aggregation- Returns:
- the ordered set-aggregate function expression
-