Interface CriteriaBuilder
public interface CriteriaBuilder
Used to construct criteria queries, compound selections,
expressions, predicates, orderings.
Note that Predicate is used instead of
Expression<Boolean> in this API in
order to work around the fact that Java generics are not
compatible with varags.
- Since:
- 2.0
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceInterface used to build general case expressions.static interfaceInterface used to build coalesce expressions.static interfaceInterface used to build in predicates.static interfaceInterface used to build simple case expressions.static enumUsed to specify how strings are trimmed. -
Method Summary
Modifier and TypeMethodDescription<N extends Number>
Expression<N> abs(Expression<N> x) Create an expression that returns the absolute value of its argument.<Y> Expression<Y> Create an all expression over the subquery results.and(BooleanExpression... restrictions) Create a conjunction of the given restriction predicates.and(Expression<Boolean> x, Expression<Boolean> y) Create a conjunction of the given boolean expressions.and(List<? extends Expression<Boolean>> restrictions) Create a conjunction of the given restriction predicates.<Y> Expression<Y> Create an any expression over the subquery results.Create an array-valued selection item.Create an array-valued selection item.asc(Expression<?> expression) Create an ordering by the ascending value of the expression.asc(Expression<?> expression, Nulls nullPrecedence) Create an ordering by the ascending value of the expression.augment(StatementReference reference, Consumer<CriteriaStatement<?>> augmentation) Modify the Jakarta Persistence query language statement represented by the given reference, returning a reference to the modified statement inheriting all the options of the given reference.<T> TypedQueryReference<T> augment(TypedQueryReference<T> reference, Consumer<CriteriaQuery<T>> augmentation) Modify the Jakarta Persistence query language query represented by the given reference, returning a reference to the modified query inheriting all the options of the given reference.<N extends Number>
Expression<Double> avg(Expression<N> x) Create an aggregate expression applying the avg operation.<Y extends Comparable<? super Y>>
Predicatebetween(Expression<? extends Y> v, Expression<? extends Y> x, Expression<? extends Y> y) Create a predicate for testing whether the first argument is between the second and third arguments in value.<Y extends Comparable<? super Y>>
Predicatebetween(Expression<? extends Y> v, Y x, Y y) Create a predicate for testing whether the first argument is between the second and third arguments in value.<Y extends Comparable<? super Y>>
Predicatebetween(Y v, Expression<? extends Y> x, Expression<? extends Y> y) Create a predicate for testing whether the first argument is between the second and third arguments in value.booleanLiteral(boolean value) Create a boolean expression for a literal.<N extends Number>
Expression<N> ceiling(Expression<N> x) Create an expression that returns the ceiling of its argument, that is, the smallest integer greater than or equal to its argument.<T> CriteriaBuilder.Coalesce<T> coalesce()Create a coalesce expression.<Y> Expression<Y> coalesce(Expression<? extends Y> x, Expression<? extends Y> y) Create an expression that returns null if all its arguments evaluate to null, and the value of the first non-null argument otherwise.<Y> Expression<Y> coalesce(Expression<? extends Y> x, Y y) Create an expression that returns null if all its arguments evaluate to null, and the value of the first non-null argument otherwise.concat(Expression<String> x, Expression<String> y) Create an expression for string concatenation.concat(Expression<String> x, String y) Create an expression for string concatenation.concat(String x, Expression<String> y) Create an expression for string concatenation.concat(List<Expression<String>> expressions) Create an expression for string concatenation.Create a conjunction (with zero conjuncts).<Y> CompoundSelection<Y> Create a selection item corresponding to a constructor.<T> ParameterExpression<T> convertedParameter(Class<? extends AttributeConverter<T, ?>> converter) Create a parameter expression whose value is bound via a converter.count(Expression<?> x) Create an aggregate expression applying the count operation.countDistinct(Expression<?> x) Create an aggregate expression applying the count distinct operation.<T> CriteriaDelete<T> createCriteriaDelete(Class<T> targetEntity) Create aCriteriaDeleteobject to perform a bulk delete operation.<T> CriteriaDelete<T> createCriteriaDelete(Class<T> targetEntity, String jpql) Create aCriteriaDeleteobject representing the given Jakarta Persistence query languageDELETEquery with the given target entity type.createCriteriaDelete(String jpql) Create aCriteriaDeleteobject representing the given Jakarta Persistence query languageDELETEquery.<T> CriteriaUpdate<T> createCriteriaUpdate(Class<T> targetEntity) Create aCriteriaUpdateobject to perform a bulk update operation.<T> CriteriaUpdate<T> createCriteriaUpdate(Class<T> targetEntity, String jpql) Create aCriteriaUpdateobject representing the given Jakarta Persistence query languageUPDATEquery with the given target entity type.createCriteriaUpdate(String jpql) Create aCriteriaUpdateobject representing the given Jakarta Persistence query languageUPDATEquery.Create aCriteriaQueryobject.<T> CriteriaQuery<T> createQuery(Class<T> resultClass) Create aCriteriaQueryobject with the given result type.<T> CriteriaQuery<T> createQuery(Class<T> resultClass, String jpql) Create aCriteriaQueryobject representing the given Jakarta Persistence query languageSELECTquery with the given result type.createQuery(String jpql) Create aCriteriaQueryobject representing the given Jakarta Persistence query languageSELECTquery.Create aCriteriaQueryobject that returns a tuple of objects as its result.Create expression to return current date.Create expression to return current time.Create expression to return current timestamp.desc(Expression<?> expression) Create an ordering by the descending value of the expression.desc(Expression<?> expression, Nulls nullPrecedence) Create an ordering by the descending value of the expression.<N extends Number>
Expression<N> diff(Expression<? extends N> x, Expression<? extends N> y) Create an expression that returns the difference between its arguments.<N extends Number>
Expression<N> diff(Expression<? extends N> x, N y) Create an expression that returns the difference between its arguments.<N extends Number>
Expression<N> diff(N x, Expression<? extends N> y) Create an expression that returns the difference between its arguments.Create a disjunction (with zero disjuncts).equal(Expression<?> x, Expression<?> y) Create a predicate for testing the arguments for equality.equal(Expression<?> x, Object y) Create a predicate for testing the arguments for equality.<T> CriteriaSelect<T> except(CriteriaSelect<T> left, CriteriaSelect<?> right) Create a query by (setwise) subtraction of the second query from the first query.<T> CriteriaSelect<T> exceptAll(CriteriaSelect<T> left, CriteriaSelect<?> right) Create a query by (setwise) subtraction of the second query from the first query, without elimination of duplicate results.Create a predicate testing the existence of a subquery result.exp(Expression<? extends Number> x) Create an expression that returns the exponential of its argument, that is, Euler's number e raised to the power of its argument.<N, T extends Temporal>
Expression<N> extract(TemporalField<N, T> field, Expression<T> temporal) Create an expression that returns the value of a field extracted from a date, time, or datetime.<N extends Number>
Expression<N> floor(Expression<N> x) Create an expression that returns the floor of its argument, that is, the largest integer smaller than or equal to its argument.<T> Expression<T> function(String name, Class<T> type, Expression<?>... args) Create an expression for the execution of the database function with the given name.ge(Expression<? extends Number> x, Expression<? extends Number> y) Create a predicate for testing whether the first argument is greater than or equal to the second.ge(Expression<? extends Number> x, Number y) Create a predicate for testing whether the first argument is greater than or equal to the second.<Y extends Comparable<? super Y>>
PredicategreaterThan(Expression<? extends Y> x, Expression<? extends Y> y) Create a predicate for testing whether the first argument is greater than the second.<Y extends Comparable<? super Y>>
PredicategreaterThan(Expression<? extends Y> x, Y y) Create a predicate for testing whether the first argument is greater than the second.<Y extends Comparable<? super Y>>
PredicategreaterThanOrEqualTo(Expression<? extends Y> x, Expression<? extends Y> y) Create a predicate for testing whether the first argument is greater than or equal to the second.<Y extends Comparable<? super Y>>
PredicategreaterThanOrEqualTo(Expression<? extends Y> x, Y y) Create a predicate for testing whether the first argument is greater than or equal to the second.<X extends Comparable<? super X>>
Expression<X> greatest(Expression<X> x) Create an aggregate expression for finding the greatest of the values (strings, dates, etc).gt(Expression<? extends Number> x, Expression<? extends Number> y) Create a predicate for testing whether the first argument is greater than the second.gt(Expression<? extends Number> x, Number y) Create a predicate for testing whether the first argument is greater than the second.<T> CriteriaBuilder.In<T> in(Expression<? extends T> expression) Create predicate to test whether given expression is contained in a list of values.<T> CriteriaSelect<T> intersect(CriteriaSelect<? super T> left, CriteriaSelect<? super T> right) Create a query which is the intersection of the given queries.<T> CriteriaSelect<T> intersectAll(CriteriaSelect<? super T> left, CriteriaSelect<? super T> right) Create a query which is the intersection of the given queries, without elimination of duplicate results.<C extends Collection<?>>
PredicateisEmpty(Expression<C> collection) Create a predicate that tests whether a collection is empty.isFalse(Expression<Boolean> x) Create a predicate testing for a false value.<E, C extends Collection<E>>
PredicateisMember(E elem, Expression<C> collection) Create a predicate that tests whether an element is a member of a collection.<E, C extends Collection<E>>
PredicateisMember(Expression<E> elem, Expression<C> collection) Create a predicate that tests whether an element is a member of a collection.<C extends Collection<?>>
PredicateisNotEmpty(Expression<C> collection) Create a predicate that tests whether a collection is not empty.<E, C extends Collection<E>>
PredicateisNotMember(E elem, Expression<C> collection) Create a predicate that tests whether an element is not a member of a collection.<E, C extends Collection<E>>
PredicateisNotMember(Expression<E> elem, Expression<C> collection) Create a predicate that tests whether an element is not a member of a collection.isNotNull(Expression<?> x) Create a predicate to test whether the expression is not null.isNull(Expression<?> x) Create a predicate to test whether the expression is null.isTrue(Expression<Boolean> x) Create a predicate testing for a true value.le(Expression<? extends Number> x, Expression<? extends Number> y) Create a predicate for testing whether the first argument is less than or equal to the second.le(Expression<? extends Number> x, Number y) Create a predicate for testing whether the first argument is less than or equal to the second.<X extends Comparable<? super X>>
Expression<X> least(Expression<X> x) Create an aggregate expression for finding the least of the values (strings, dates, etc).left(Expression<String> x, int len) Create an expression for the leftmost substring of a string,left(Expression<String> x, Expression<Integer> len) Create an expression for the leftmost substring of a string,length(Expression<String> x) Create expression to return length of a string.<Y extends Comparable<? super Y>>
PredicatelessThan(Expression<? extends Y> x, Expression<? extends Y> y) Create a predicate for testing whether the first argument is less than the second.<Y extends Comparable<? super Y>>
PredicatelessThan(Expression<? extends Y> x, Y y) Create a predicate for testing whether the first argument is less than the second.<Y extends Comparable<? super Y>>
PredicatelessThanOrEqualTo(Expression<? extends Y> x, Expression<? extends Y> y) Create a predicate for testing whether the first argument is less than or equal to the second.<Y extends Comparable<? super Y>>
PredicatelessThanOrEqualTo(Expression<? extends Y> x, Y y) Create a predicate for testing whether the first argument is less than or equal to the second.like(Expression<String> x, Expression<String> pattern) Create a predicate for testing whether the expression satisfies the given pattern.like(Expression<String> x, Expression<String> pattern, char escapeChar) Create a predicate for testing whether the expression satisfies the given pattern.like(Expression<String> x, Expression<String> pattern, Expression<Character> escapeChar) Create a predicate for testing whether the expression satisfies the given pattern.like(Expression<String> x, String pattern) Create a predicate for testing whether the expression satisfies the given pattern.like(Expression<String> x, String pattern, char escapeChar) Create a predicate for testing whether the expression satisfies the given pattern.like(Expression<String> x, String pattern, Expression<Character> escapeChar) Create a predicate for testing whether the expression satisfies the given pattern.<T> Expression<T> literal(T value) Create an expression for a literal.ln(Expression<? extends Number> x) Create an expression that returns the natural logarithm of its argument.Create expression to return current local date.Create expression to return current local datetime.Create expression to return current local time.locate(Expression<String> x, Expression<String> pattern) Create expression to locate the position of one string within another, returning position of first character if found.locate(Expression<String> x, Expression<String> pattern, Expression<Integer> from) Create expression to locate the position of one string within another, returning position of first character if found.locate(Expression<String> x, String pattern) Create expression to locate the position of one string within another, returning position of first character if found.locate(Expression<String> x, String pattern, int from) Create expression to locate the position of one string within another, returning position of first character if found.lower(Expression<String> x) Create expression for converting a string to lowercase.lt(Expression<? extends Number> x, Expression<? extends Number> y) Create a predicate for testing whether the first argument is less than the second.lt(Expression<? extends Number> x, Number y) Create a predicate for testing whether the first argument is less than the second.<N extends Number>
Expression<N> max(Expression<N> x) Create an aggregate expression applying the numerical max operation.<N extends Number>
Expression<N> min(Expression<N> x) Create an aggregate expression applying the numerical min operation.mod(Expression<Integer> x, Expression<Integer> y) Create an expression that returns the modulus (remainder under integer division) of its arguments.mod(Expression<Integer> x, Integer y) Create an expression that returns the modulus (remainder under integer division) of its arguments.mod(Integer x, Expression<Integer> y) Create an expression that returns the modulus (remainder under integer division) of its arguments.<N extends Number>
Expression<N> neg(Expression<N> x) Create an expression that returns the arithmetic negation of its argument.not(Expression<Boolean> restriction) Create a negation of the given restriction.notEqual(Expression<?> x, Expression<?> y) Create a predicate for testing the arguments for inequality.notEqual(Expression<?> x, Object y) Create a predicate for testing the arguments for inequality.notLike(Expression<String> x, Expression<String> pattern) Create a predicate for testing whether the expression does not satisfy the given pattern.notLike(Expression<String> x, Expression<String> pattern, char escapeChar) Create a predicate for testing whether the expression does not satisfy the given pattern.notLike(Expression<String> x, Expression<String> pattern, Expression<Character> escapeChar) Create a predicate for testing whether the expression does not satisfy the given pattern.notLike(Expression<String> x, String pattern) Create a predicate for testing whether the expression does not satisfy the given pattern.notLike(Expression<String> x, String pattern, char escapeChar) Create a predicate for testing whether the expression does not satisfy the given pattern.notLike(Expression<String> x, String pattern, Expression<Character> escapeChar) Create a predicate for testing whether the expression does not satisfy the given pattern.<Y> Expression<Y> nullif(Expression<Y> x, Expression<?> y) Create an expression that tests whether its argument are equal, returning null if they are and the value of the first expression if they are not.<Y> Expression<Y> nullif(Expression<Y> x, Y y) Create an expression that tests whether its argument are equal, returning null if they are and the value of the first expression if they are not.<T> Expression<T> nullLiteral(Class<T> resultClass) Create an expression for a null literal with the given type.<N extends Number & Comparable<N>>
NumericExpression<N> numericLiteral(N value) Create a number expression for a literal.or(BooleanExpression... restrictions) Create a disjunction of the given restriction predicates.or(Expression<Boolean> x, Expression<Boolean> y) Create a disjunction of the given boolean expressions.or(List<? extends Expression<Boolean>> restrictions) Create a disjunction of the given restriction predicates.<T> ParameterExpression<T> Create a parameter expression.<T> ParameterExpression<T> Create a parameter expression with the given name.power(Expression<? extends Number> x, Expression<? extends Number> y) Create an expression that returns the first argument raised to the power of its second argument.power(Expression<? extends Number> x, Number y) Create an expression that returns the first argument raised to the power of its second argument.<N extends Number>
Expression<N> prod(Expression<? extends N> x, Expression<? extends N> y) Create an expression that returns the product of its arguments.<N extends Number>
Expression<N> prod(Expression<? extends N> x, N y) Create an expression that returns the product of its arguments.<N extends Number>
Expression<N> prod(N x, Expression<? extends N> y) Create an expression that returns the product of its arguments.quot(Expression<? extends Number> x, Expression<? extends Number> y) Create an expression that returns the quotient of its arguments.quot(Expression<? extends Number> x, Number y) Create an expression that returns the quotient of its arguments.quot(Number x, Expression<? extends Number> y) Create an expression that returns the quotient of its arguments.replace(Expression<String> x, Expression<String> substring, Expression<String> replacement) Create an expression replacing every occurrence of a substring within a string.replace(Expression<String> x, Expression<String> substring, String replacement) Create an expression replacing every occurrence of a substring within a string.replace(Expression<String> x, String substring, Expression<String> replacement) Create an expression replacing every occurrence of a substring within a string.replace(Expression<String> x, String substring, String replacement) Create an expression replacing every occurrence of a substring within a string.right(Expression<String> x, int len) Create an expression for the rightmost substring of a string,right(Expression<String> x, Expression<Integer> len) Create an expression for the rightmost substring of a string,<T extends Number>
Expression<T> round(Expression<T> x, Integer n) Create an expression that returns the first argument rounded to the number of decimal places given by the second argument.<R> CriteriaBuilder.Case<R> Deprecated.This operation declares an unconstrained type variable.<C,R> CriteriaBuilder.SimpleCase <C, R> selectCase(Expression<? extends C> expression) Deprecated.This operation declares an unconstrained type variable.<C,R> CriteriaBuilder.SimpleCase <C, R> selectCase(Expression<? extends C> expression, Class<R> type) Create a simple case expression.<R> CriteriaBuilder.Case<R> selectCase(Class<R> type) Create a general case expression.sign(Expression<? extends Number> x) Create an expression that returns the sign of its argument, that is,1if its argument is positive,-1if its argument is negative, or0if its argument is exactly zero.<C extends Collection<?>>
Expression<Integer> size(C collection) Create an expression that tests the size of a collection.<C extends Collection<?>>
Expression<Integer> size(Expression<C> collection) Create an expression that tests the size of a collection.<Y> Expression<Y> Create a some expression over the subquery results.sqrt(Expression<? extends Number> x) Create an expression that returns the square root of its argument.stringLiteral(String value) Create a string expression for a literal.substring(Expression<String> x, int from) Create an expression for substring extraction.substring(Expression<String> x, int from, int len) Create an expression for substring extraction.substring(Expression<String> x, Expression<Integer> from) Create an expression for substring extraction.substring(Expression<String> x, Expression<Integer> from, Expression<Integer> len) Create an expression for substring extraction.<N extends Number>
Expression<N> sum(Expression<? extends N> x, Expression<? extends N> y) Create an expression that returns the sum of its arguments.<N extends Number>
Expression<N> sum(Expression<? extends N> x, N y) Create an expression that returns the sum of its arguments.<N extends Number>
Expression<N> sum(Expression<N> x) Create an aggregate expression applying the sum operation.<N extends Number>
Expression<N> sum(N x, Expression<? extends N> y) Create an expression that returns the sum of its arguments.Create an aggregate expression applying the sum operation to a Float-valued expression, returning a Double result.Create an aggregate expression applying the sum operation to an Integer-valued expression, returning a Long result.<T extends Temporal & Comparable<? super T>>
TemporalExpression<T> temporalLiteral(T value) Create a local date expression for a literal.toBigDecimal(Expression<? extends Number> number) Typecast.toBigInteger(Expression<? extends Number> number) Typecast.toDouble(Expression<? extends Number> number) Typecast.toFloat(Expression<? extends Number> number) Typecast.toInteger(Expression<? extends Number> number) Typecast.toLong(Expression<? extends Number> number) Typecast.toString(Expression<Character> character) Typecast.<X, T, E extends T>
CollectionJoin<X, E> treat(CollectionJoin<X, T> join, Class<E> type) Downcast CollectionJoin object to the specified type.<X, Y, T extends Y>
From<X, T> Downcast Root or Join to the specified type.<X, T, V extends T>
Join<X, V> Downcast Join object to the specified type.<X, T, E extends T>
ListJoin<X, E> Downcast ListJoin object to the specified type.<X, K, T, V extends T>
MapJoin<X, K, V> Downcast MapJoin object to the specified type.<X, T extends X>
Path<T> Downcast Path object to the specified type.<X, T extends X>
Root<T> Downcast Root object to the specified type.<X, T, E extends T>
SetJoin<X, E> Downcast SetJoin object to the specified type.trim(char t, Expression<String> x) Create expression to trim character from both ends of a string.trim(CriteriaBuilder.Trimspec ts, char t, Expression<String> x) Create expression to trim character from a string.trim(CriteriaBuilder.Trimspec ts, Expression<Character> t, Expression<String> x) Create expression to trim character from a string.trim(CriteriaBuilder.Trimspec ts, Expression<String> x) Create expression to trim blanks from a string.trim(Expression<Character> t, Expression<String> x) Create expression to trim character from both ends of a string.trim(Expression<String> x) Create expression to trim blanks from both ends of a string.Create a tuple-valued selection item.Create a tuple-valued selection item.<T> CriteriaSelect<T> union(CriteriaSelect<? extends T> left, CriteriaSelect<? extends T> right) Create a query which is the union of the given queries.<T> CriteriaSelect<T> unionAll(CriteriaSelect<? extends T> left, CriteriaSelect<? extends T> right) Create a query which is the union of the given queries, without elimination of duplicate results.upper(Expression<String> x) Create expression for converting a string to uppercase.
-
Method Details
-
createQuery
Create aCriteriaQueryobject.- Returns:
- criteria query object
-
createQuery
Create aCriteriaQueryobject with the given result type.- Type Parameters:
T- the query result type- Parameters:
resultClass- type of the query result- Returns:
- criteria query object
-
createQuery
Create aCriteriaQueryobject representing the given Jakarta Persistence query languageSELECTquery with the given result type.- Type Parameters:
T- the query result type- Parameters:
resultClass- type of the query resultjpql- A Jakarta Persistence query languageSELECTquery- Returns:
- criteria query object
- Throws:
IllegalArgumentException- if the query string is found to be invalid, or if the query result is found to not be assignable to the specified type and the specified type does not have a suitable constructor- Since:
- 4.0
-
createQuery
Create aCriteriaQueryobject representing the given Jakarta Persistence query languageSELECTquery.- Parameters:
jpql- A Jakarta Persistence query languageSELECTquery- Returns:
- criteria query object
- Throws:
IllegalArgumentException- if the query string is found to be invalid- Since:
- 4.0
-
createTupleQuery
Create aCriteriaQueryobject that returns a tuple of objects as its result.- Returns:
- criteria query object
-
createCriteriaUpdate
Create aCriteriaUpdateobject to perform a bulk update operation.- Type Parameters:
T- the target entity type- Parameters:
targetEntity- target type for update operation- Returns:
- the criteria statement object
- Since:
- 2.1
-
createCriteriaUpdate
@Nonnull <T> CriteriaUpdate<T> createCriteriaUpdate(@Nonnull Class<T> targetEntity, @Nonnull String jpql) Create aCriteriaUpdateobject representing the given Jakarta Persistence query languageUPDATEquery with the given target entity type.- Type Parameters:
T- the target entity type- Parameters:
targetEntity- target type for update operationjpql- A Jakarta Persistence query languageUPDATEquery- Returns:
- the criteria statement object
- Throws:
IllegalArgumentException- if the query string is found to be invalid, or if the entity type updated by the query is not exactly the same as the specified target type- Since:
- 4.0
-
createCriteriaUpdate
Create aCriteriaUpdateobject representing the given Jakarta Persistence query languageUPDATEquery.- Parameters:
jpql- A Jakarta Persistence query languageUPDATEquery- Returns:
- the criteria statement object
- Throws:
IllegalArgumentException- if the query string is found to be invalid- Since:
- 4.0
-
createCriteriaDelete
Create aCriteriaDeleteobject to perform a bulk delete operation.- Type Parameters:
T- the target entity type- Parameters:
targetEntity- target type for delete operation- Returns:
- the criteria statement object
- Since:
- 2.1
-
createCriteriaDelete
@Nonnull <T> CriteriaDelete<T> createCriteriaDelete(@Nonnull Class<T> targetEntity, @Nonnull String jpql) Create aCriteriaDeleteobject representing the given Jakarta Persistence query languageDELETEquery with the given target entity type.- Type Parameters:
T- the target entity type- Parameters:
targetEntity- target type for delete operationjpql- A Jakarta Persistence query languageDELETEquery- Returns:
- the criteria statement object
- Throws:
IllegalArgumentException- if the query string is found to be invalid, or if the entity type deleted by the query is not exactly the same as the specified target type- Since:
- 4.0
-
createCriteriaDelete
Create aCriteriaDeleteobject representing the given Jakarta Persistence query languageDELETEquery.- Parameters:
jpql- A Jakarta Persistence query languageDELETEquery- Returns:
- the criteria statement object
- Throws:
IllegalArgumentException- if the query string is found to be invalid- Since:
- 4.0
-
augment
@Nonnull <T> TypedQueryReference<T> augment(@Nonnull TypedQueryReference<T> reference, @Nonnull Consumer<CriteriaQuery<T>> augmentation) Modify the Jakarta Persistence query language query represented by the given reference, returning a reference to the modified query inheriting all the options of the given reference. This operation never modifies the query represented by the given reference.- Type Parameters:
T- the query result type- Parameters:
reference- A reference to a Jakarta Persistence query languageSELECTqueryaugmentation- a consumer that modifies the query- Returns:
- a reference to the modified query
- Throws:
IllegalArgumentException- if the given reference does not represent a named Jakarta Persistence query languageSELECTquery belonging to the owning factory- Since:
- 4.0
-
augment
@Nonnull StatementReference augment(@Nonnull StatementReference reference, @Nonnull Consumer<CriteriaStatement<?>> augmentation) Modify the Jakarta Persistence query language statement represented by the given reference, returning a reference to the modified statement inheriting all the options of the given reference. This operation never modifies the query represented by the given reference.- Parameters:
reference- A reference to a Jakarta Persistence query language statementaugmentation- a consumer that modifies the statement- Returns:
- a reference to the modified statement
- Throws:
IllegalArgumentException- if the given reference does not represent a named Jakarta Persistence query language statement belonging to the owning factory- Since:
- 4.0
-
construct
@Nonnull <Y> CompoundSelection<Y> construct(@Nonnull Class<Y> resultClass, @Nonnull Selection<?>... selections) Create a selection item corresponding to a constructor. This method is used to specify a constructor that is applied to the results of the query execution. If the constructor is for an entity class, the resulting entities will be in the new state after the query is executed.- Type Parameters:
Y- the type of the constructed result- Parameters:
resultClass- class whose instance is to be constructedselections- arguments to the constructor- Returns:
- compound selection item
- Throws:
IllegalArgumentException- if an argument is a tuple- or array-valued selection item
-
tuple
Create a tuple-valued selection item.- Parameters:
selections- selection items- Returns:
- tuple-valued compound selection
- Throws:
IllegalArgumentException- if an argument is a tuple- or array-valued selection item
-
tuple
Create a tuple-valued selection item.- Parameters:
selections- list of selection items- Returns:
- tuple-valued compound selection
- Throws:
IllegalArgumentException- if an argument is a tuple- or array-valued selection item- Since:
- 3.2
-
array
Create an array-valued selection item.- Parameters:
selections- selection items- Returns:
- array-valued compound selection
- Throws:
IllegalArgumentException- if an argument is a tuple- or array-valued selection item
-
array
Create an array-valued selection item.- Parameters:
selections- list of selection items- Returns:
- array-valued compound selection
- Throws:
IllegalArgumentException- if an argument is a tuple- or array-valued selection item- Since:
- 3.2
-
asc
Create an ordering by the ascending value of the expression.- Parameters:
expression- expression used to define the ordering- Returns:
- ascending ordering corresponding to the expression
-
desc
Create an ordering by the descending value of the expression.- Parameters:
expression- expression used to define the ordering- Returns:
- descending ordering corresponding to the expression
-
asc
Create an ordering by the ascending value of the expression.- Parameters:
expression- expression used to define the orderingnullPrecedence- the precedence of null values- Returns:
- ascending ordering corresponding to the expression
- Since:
- 3.2
-
desc
Create an ordering by the descending value of the expression.- Parameters:
expression- expression used to define the orderingnullPrecedence- the precedence of null values- Returns:
- descending ordering corresponding to the expression
- Since:
- 3.2
-
avg
Create an aggregate expression applying the avg operation.- Type Parameters:
N- the numeric type of the expression- Parameters:
x- expression representing input value to avg operation- Returns:
- avg expression
-
sum
Create an aggregate expression applying the sum operation.- Type Parameters:
N- the numeric type of the expression- Parameters:
x- expression representing input value to sum operation- Returns:
- sum expression
-
sumAsLong
Create an aggregate expression applying the sum operation to an Integer-valued expression, returning a Long result.- Parameters:
x- expression representing input value to sum operation- Returns:
- sum expression
-
sumAsDouble
Create an aggregate expression applying the sum operation to a Float-valued expression, returning a Double result.- Parameters:
x- expression representing input value to sum operation- Returns:
- sum expression
-
max
Create an aggregate expression applying the numerical max operation.- Type Parameters:
N- the numeric type of the expression- Parameters:
x- expression representing input value to max operation- Returns:
- max expression
-
min
Create an aggregate expression applying the numerical min operation.- Type Parameters:
N- the numeric type of the expression- Parameters:
x- expression representing input value to min operation- Returns:
- min expression
-
greatest
Create an aggregate expression for finding the greatest of the values (strings, dates, etc).- Type Parameters:
X- the type of the expression- Parameters:
x- expression representing input value to greatest operation- Returns:
- greatest expression
-
least
Create an aggregate expression for finding the least of the values (strings, dates, etc).- Type Parameters:
X- the type of the expression- Parameters:
x- expression representing input value to least operation- Returns:
- least expression
-
count
Create an aggregate expression applying the count operation.- Parameters:
x- expression representing input value to count operation- Returns:
- count expression
-
countDistinct
Create an aggregate expression applying the count distinct operation.- Parameters:
x- expression representing input value to count distinct operation- Returns:
- count distinct expression
-
exists
-
all
Create an all expression over the subquery results.- Type Parameters:
Y- the subquery result type- Parameters:
subquery- subquery- Returns:
- all expression
-
some
Create a some expression over the subquery results. This expression is equivalent to ananyexpression.- Type Parameters:
Y- the subquery result type- Parameters:
subquery- subquery- Returns:
- some expression
-
any
Create an any expression over the subquery results. This expression is equivalent to asomeexpression.- Type Parameters:
Y- the subquery result type- Parameters:
subquery- subquery- Returns:
- any expression
-
and
Create a conjunction of the given boolean expressions.- Parameters:
x- boolean expressiony- boolean expression- Returns:
- and predicate
-
and
Create a conjunction of the given restriction predicates. A conjunction of zero predicates is true.- Parameters:
restrictions- zero or more restriction predicates- Returns:
- and predicate
-
and
Create a conjunction of the given restriction predicates. A conjunction of zero predicates is true.- Parameters:
restrictions- a list of zero or more restriction predicates- Returns:
- and predicate
- Since:
- 3.2
-
or
Create a disjunction of the given boolean expressions.- Parameters:
x- boolean expressiony- boolean expression- Returns:
- or predicate
-
or
Create a disjunction of the given restriction predicates. A disjunction of zero predicates is false.- Parameters:
restrictions- zero or more restriction predicates- Returns:
- or predicate
-
or
Create a disjunction of the given restriction predicates. A disjunction of zero predicates is false.- Parameters:
restrictions- a list of zero or more restriction predicates- Returns:
- or predicate
- Since:
- 3.2
-
not
Create a negation of the given restriction.- Parameters:
restriction- restriction expression- Returns:
- not predicate
-
conjunction
Create a conjunction (with zero conjuncts). A conjunction with zero conjuncts is true.- Returns:
- and predicate
-
disjunction
Create a disjunction (with zero disjuncts). A disjunction with zero disjuncts is false.- Returns:
- or predicate
-
isTrue
Create a predicate testing for a true value.- Parameters:
x- expression to be tested- Returns:
- predicate
-
isFalse
Create a predicate testing for a false value.- Parameters:
x- expression to be tested- Returns:
- predicate
-
isNull
Create a predicate to test whether the expression is null.- Parameters:
x- expression- Returns:
- is-null predicate
-
isNotNull
Create a predicate to test whether the expression is not null.- Parameters:
x- expression- Returns:
- is-not-null predicate
-
equal
Create a predicate for testing the arguments for equality.- Parameters:
x- expressiony- expression- Returns:
- equality predicate
-
equal
Create a predicate for testing the arguments for equality.- Parameters:
x- expressiony- object- Returns:
- equality predicate
-
notEqual
Create a predicate for testing the arguments for inequality.- Parameters:
x- expressiony- expression- Returns:
- inequality predicate
-
notEqual
Create a predicate for testing the arguments for inequality.- Parameters:
x- expressiony- object- Returns:
- inequality predicate
-
greaterThan
@Nonnull <Y extends Comparable<? super Y>> Predicate greaterThan(@Nonnull Expression<? extends Y> x, @Nonnull Expression<? extends Y> y) Create a predicate for testing whether the first argument is greater than the second.- Type Parameters:
Y- the type of the compared expressions- Parameters:
x- expressiony- expression- Returns:
- greater-than predicate
- See Also:
-
greaterThan
@Nonnull <Y extends Comparable<? super Y>> Predicate greaterThan(@Nonnull Expression<? extends Y> x, Y y) Create a predicate for testing whether the first argument is greater than the second.- Type Parameters:
Y- the type of the compared values- Parameters:
x- expressiony- value- Returns:
- greater-than predicate
- See Also:
-
greaterThanOrEqualTo
@Nonnull <Y extends Comparable<? super Y>> Predicate greaterThanOrEqualTo(@Nonnull Expression<? extends Y> x, @Nonnull Expression<? extends Y> y) Create a predicate for testing whether the first argument is greater than or equal to the second.- Type Parameters:
Y- the type of the compared expressions- Parameters:
x- expressiony- expression- Returns:
- greater-than-or-equal predicate
- See Also:
-
greaterThanOrEqualTo
@Nonnull <Y extends Comparable<? super Y>> Predicate greaterThanOrEqualTo(@Nonnull Expression<? extends Y> x, Y y) Create a predicate for testing whether the first argument is greater than or equal to the second.- Type Parameters:
Y- the type of the compared values- Parameters:
x- expressiony- value- Returns:
- greater-than-or-equal predicate
- See Also:
-
lessThan
@Nonnull <Y extends Comparable<? super Y>> Predicate lessThan(@Nonnull Expression<? extends Y> x, @Nonnull Expression<? extends Y> y) Create a predicate for testing whether the first argument is less than the second.- Type Parameters:
Y- the type of the compared expressions- Parameters:
x- expressiony- expression- Returns:
- less-than predicate
- See Also:
-
lessThan
@Nonnull <Y extends Comparable<? super Y>> Predicate lessThan(@Nonnull Expression<? extends Y> x, Y y) Create a predicate for testing whether the first argument is less than the second.- Type Parameters:
Y- the type of the compared values- Parameters:
x- expressiony- value- Returns:
- less-than predicate
- See Also:
-
lessThanOrEqualTo
@Nonnull <Y extends Comparable<? super Y>> Predicate lessThanOrEqualTo(@Nonnull Expression<? extends Y> x, @Nonnull Expression<? extends Y> y) Create a predicate for testing whether the first argument is less than or equal to the second.- Type Parameters:
Y- the type of the compared expressions- Parameters:
x- expressiony- expression- Returns:
- less-than-or-equal predicate
- See Also:
-
lessThanOrEqualTo
@Nonnull <Y extends Comparable<? super Y>> Predicate lessThanOrEqualTo(@Nonnull Expression<? extends Y> x, Y y) Create a predicate for testing whether the first argument is less than or equal to the second.- Type Parameters:
Y- the type of the compared values- Parameters:
x- expressiony- value- Returns:
- less-than-or-equal predicate
- See Also:
-
between
@Nonnull <Y extends Comparable<? super Y>> Predicate between(@Nonnull Expression<? extends Y> v, @Nonnull Expression<? extends Y> x, @Nonnull Expression<? extends Y> y) Create a predicate for testing whether the first argument is between the second and third arguments in value.- Type Parameters:
Y- the type of the compared expressions- Parameters:
v- expressionx- expressiony- expression- Returns:
- between predicate
-
between
@Nonnull <Y extends Comparable<? super Y>> Predicate between(@Nonnull Expression<? extends Y> v, Y x, Y y) Create a predicate for testing whether the first argument is between the second and third arguments in value.- Type Parameters:
Y- the type of the compared values- Parameters:
v- expressionx- valuey- value- Returns:
- between predicate
-
between
@Nonnull <Y extends Comparable<? super Y>> Predicate between(Y v, @Nonnull Expression<? extends Y> x, @Nonnull Expression<? extends Y> y) Create a predicate for testing whether the first argument is between the second and third arguments in value.- Type Parameters:
Y- the type of the compared values- Parameters:
v- valuex- expressiony- expression- Returns:
- between predicate
- Since:
- 4.0
-
gt
@Nonnull Predicate gt(@Nonnull Expression<? extends Number> x, @Nonnull Expression<? extends Number> y) Create a predicate for testing whether the first argument is greater than the second. This operation accepts arguments of heterogeneous numeric types.- Parameters:
x- expressiony- expression- Returns:
- greater-than predicate
-
gt
Create a predicate for testing whether the first argument is greater than the second. This operation accepts arguments of heterogeneous numeric types.- Parameters:
x- expressiony- value- Returns:
- greater-than predicate
-
ge
@Nonnull Predicate ge(@Nonnull Expression<? extends Number> x, @Nonnull Expression<? extends Number> y) Create a predicate for testing whether the first argument is greater than or equal to the second. This operation accepts arguments of heterogeneous numeric types.- Parameters:
x- expressiony- expression- Returns:
- greater-than-or-equal predicate
-
ge
Create a predicate for testing whether the first argument is greater than or equal to the second. This operation accepts arguments of heterogeneous numeric types.- Parameters:
x- expressiony- value- Returns:
- greater-than-or-equal predicate
-
lt
@Nonnull Predicate lt(@Nonnull Expression<? extends Number> x, @Nonnull Expression<? extends Number> y) Create a predicate for testing whether the first argument is less than the second. This operation accepts arguments of heterogeneous numeric types.- Parameters:
x- expressiony- expression- Returns:
- less-than predicate
-
lt
Create a predicate for testing whether the first argument is less than the second. This operation accepts arguments of heterogeneous numeric types.- Parameters:
x- expressiony- value- Returns:
- less-than predicate
-
le
@Nonnull Predicate le(@Nonnull Expression<? extends Number> x, @Nonnull Expression<? extends Number> y) Create a predicate for testing whether the first argument is less than or equal to the second. This operation accepts arguments of heterogeneous numeric types.- Parameters:
x- expressiony- expression- Returns:
- less-than-or-equal predicate
-
le
Create a predicate for testing whether the first argument is less than or equal to the second. This operation accepts arguments of heterogeneous numeric types.- Parameters:
x- expressiony- value- Returns:
- less-than-or-equal predicate
-
sign
Create an expression that returns the sign of its argument, that is,1if its argument is positive,-1if its argument is negative, or0if its argument is exactly zero.- Parameters:
x- expression- Returns:
- sign
-
neg
Create an expression that returns the arithmetic negation of its argument.- Type Parameters:
N- the numeric type of the expression- Parameters:
x- expression- Returns:
- arithmetic negation
-
abs
Create an expression that returns the absolute value of its argument.- Type Parameters:
N- the numeric type of the expression- Parameters:
x- expression- Returns:
- absolute value
-
ceiling
Create an expression that returns the ceiling of its argument, that is, the smallest integer greater than or equal to its argument.- Type Parameters:
N- the numeric type of the expression- Parameters:
x- expression- Returns:
- ceiling
-
floor
Create an expression that returns the floor of its argument, that is, the largest integer smaller than or equal to its argument.- Type Parameters:
N- the numeric type of the expression- Parameters:
x- expression- Returns:
- floor
-
sum
@Nonnull <N extends Number> Expression<N> sum(@Nonnull Expression<? extends N> x, @Nonnull Expression<? extends N> y) Create an expression that returns the sum of its arguments.- Type Parameters:
N- the numeric type of the expressions- Parameters:
x- expressiony- expression- Returns:
- sum
-
sum
Create an expression that returns the sum of its arguments.- Type Parameters:
N- the numeric type of the arguments- Parameters:
x- expressiony- value- Returns:
- sum
-
sum
Create an expression that returns the sum of its arguments.- Type Parameters:
N- the numeric type of the arguments- Parameters:
x- valuey- expression- Returns:
- sum
-
prod
@Nonnull <N extends Number> Expression<N> prod(@Nonnull Expression<? extends N> x, @Nonnull Expression<? extends N> y) Create an expression that returns the product of its arguments.- Type Parameters:
N- the numeric type of the expressions- Parameters:
x- expressiony- expression- Returns:
- product
-
prod
Create an expression that returns the product of its arguments.- Type Parameters:
N- the numeric type of the arguments- Parameters:
x- expressiony- value- Returns:
- product
-
prod
Create an expression that returns the product of its arguments.- Type Parameters:
N- the numeric type of the arguments- Parameters:
x- valuey- expression- Returns:
- product
-
diff
@Nonnull <N extends Number> Expression<N> diff(@Nonnull Expression<? extends N> x, @Nonnull Expression<? extends N> y) Create an expression that returns the difference between its arguments.- Type Parameters:
N- the numeric type of the expressions- Parameters:
x- expressiony- expression- Returns:
- difference
-
diff
Create an expression that returns the difference between its arguments.- Type Parameters:
N- the numeric type of the arguments- Parameters:
x- expressiony- value- Returns:
- difference
-
diff
Create an expression that returns the difference between its arguments.- Type Parameters:
N- the numeric type of the arguments- Parameters:
x- valuey- expression- Returns:
- difference
-
quot
@Nonnull Expression<Number> quot(@Nonnull Expression<? extends Number> x, @Nonnull Expression<? extends Number> y) Create an expression that returns the quotient of its arguments.- Parameters:
x- expressiony- expression- Returns:
- quotient
-
quot
Create an expression that returns the quotient of its arguments.- Parameters:
x- expressiony- value- Returns:
- quotient
-
quot
Create an expression that returns the quotient of its arguments.- Parameters:
x- valuey- expression- Returns:
- quotient
-
mod
Create an expression that returns the modulus (remainder under integer division) of its arguments.- Parameters:
x- expressiony- expression- Returns:
- modulus
-
mod
Create an expression that returns the modulus (remainder under integer division) of its arguments.- Parameters:
x- expressiony- value- Returns:
- modulus
-
mod
Create an expression that returns the modulus (remainder under integer division) of its arguments.- Parameters:
x- valuey- expression- Returns:
- modulus
-
sqrt
Create an expression that returns the square root of its argument.- Parameters:
x- expression- Returns:
- square root
-
exp
Create an expression that returns the exponential of its argument, that is, Euler's number e raised to the power of its argument.- Parameters:
x- expression- Returns:
- exponential
-
ln
Create an expression that returns the natural logarithm of its argument.- Parameters:
x- expression- Returns:
- natural logarithm
-
power
@Nonnull Expression<Double> power(@Nonnull Expression<? extends Number> x, @Nonnull Expression<? extends Number> y) Create an expression that returns the first argument raised to the power of its second argument.- Parameters:
x- basey- exponent- Returns:
- the base raised to the power of the exponent
-
power
Create an expression that returns the first argument raised to the power of its second argument.- Parameters:
x- basey- exponent- Returns:
- the base raised to the power of the exponent
-
round
Create an expression that returns the first argument rounded to the number of decimal places given by the second argument.- Type Parameters:
T- the numeric type of the expression- Parameters:
x- basen- number of decimal places- Returns:
- the rounded value
-
toLong
Typecast.- Parameters:
number- numeric expression- Returns:
- Expression<Long>
-
toInteger
Typecast.- Parameters:
number- numeric expression- Returns:
- Expression<Integer>
-
toFloat
Typecast.- Parameters:
number- numeric expression- Returns:
- Expression<Float>
-
toDouble
Typecast.- Parameters:
number- numeric expression- Returns:
- Expression<Double>
-
toBigDecimal
Typecast.- Parameters:
number- numeric expression- Returns:
- Expression<BigDecimal>
-
toBigInteger
Typecast.- Parameters:
number- numeric expression- Returns:
- Expression<BigInteger>
-
toString
Typecast.- Parameters:
character- expression- Returns:
- Expression<String>
-
literal
Create an expression for a literal.- Type Parameters:
T- the type of the literal value- Parameters:
value- value represented by the expression- Returns:
- expression literal
- Throws:
IllegalArgumentException- if value is null
-
numericLiteral
Create a number expression for a literal.- Type Parameters:
N- the numeric type of the literal value- Parameters:
value- value represented by the expression- Returns:
- expression literal
- Throws:
IllegalArgumentException- if value is null- Since:
- 4.0
-
stringLiteral
Create a string expression for a literal.- Parameters:
value- value represented by the expression- Returns:
- expression literal
- Throws:
IllegalArgumentException- if value is null- Since:
- 4.0
-
temporalLiteral
@Nonnull <T extends Temporal & Comparable<? super T>> TemporalExpression<T> temporalLiteral(@Nonnull T value) Create a local date expression for a literal.- Type Parameters:
T- the temporal type of the literal value- Parameters:
value- value represented by the expression- Returns:
- expression literal
- Throws:
IllegalArgumentException- if value is null- Since:
- 4.0
-
booleanLiteral
Create a boolean expression for a literal.- Returns:
- expression literal
- Since:
- 4.0
-
nullLiteral
Create an expression for a null literal with the given type.- Type Parameters:
T- the type of the null literal- Parameters:
resultClass- type of the null literal- Returns:
- null expression literal
-
parameter
Create a parameter expression.- Type Parameters:
T- the parameter type- Parameters:
paramClass- parameter class- Returns:
- parameter expression
-
parameter
Create a parameter expression with the given name.- Type Parameters:
T- the parameter type- Parameters:
paramClass- parameter classname- name that can be used to refer to the parameter- Returns:
- parameter expression
-
convertedParameter
@Nonnull <T> ParameterExpression<T> convertedParameter(@Nonnull Class<? extends AttributeConverter<T, ?>> converter) Create a parameter expression whose value is bound via a converter.- Type Parameters:
T- the parameter type- Parameters:
converter- the class of the attribute converter- Returns:
- parameter expression
- Since:
- 4.0
-
isEmpty
Create a predicate that tests whether a collection is empty.- Type Parameters:
C- the collection type- Parameters:
collection- expression- Returns:
- is-empty predicate
-
isNotEmpty
Create a predicate that tests whether a collection is not empty.- Type Parameters:
C- the collection type- Parameters:
collection- expression- Returns:
- is-not-empty predicate
-
size
Create an expression that tests the size of a collection.- Type Parameters:
C- the collection type- Parameters:
collection- expression- Returns:
- size expression
-
size
Create an expression that tests the size of a collection.- Type Parameters:
C- the collection type- Parameters:
collection- collection- Returns:
- size expression
-
isMember
@Nonnull <E, C extends Collection<E>> Predicate isMember(@Nonnull Expression<E> elem, @Nonnull Expression<C> collection) Create a predicate that tests whether an element is a member of a collection. If the collection is empty, the predicate will be false.- Type Parameters:
E- the element typeC- the collection type- Parameters:
elem- element expressioncollection- expression- Returns:
- is-member predicate
-
isMember
Create a predicate that tests whether an element is a member of a collection. If the collection is empty, the predicate will be false.- Type Parameters:
E- the element typeC- the collection type- Parameters:
elem- elementcollection- expression- Returns:
- is-member predicate
-
isNotMember
@Nonnull <E, C extends Collection<E>> Predicate isNotMember(@Nonnull Expression<E> elem, @Nonnull Expression<C> collection) Create a predicate that tests whether an element is not a member of a collection. If the collection is empty, the predicate will be true.- Type Parameters:
E- the element typeC- the collection type- Parameters:
elem- element expressioncollection- expression- Returns:
- is-not-member predicate
-
isNotMember
@Nonnull <E, C extends Collection<E>> Predicate isNotMember(E elem, @Nonnull Expression<C> collection) Create a predicate that tests whether an element is not a member of a collection. If the collection is empty, the predicate will be true.- Type Parameters:
E- the element typeC- the collection type- Parameters:
elem- elementcollection- expression- Returns:
- is-not-member predicate
-
like
Create a predicate for testing whether the expression satisfies the given pattern.- Parameters:
x- string expressionpattern- string expression- Returns:
- like predicate
-
like
Create a predicate for testing whether the expression satisfies the given pattern.- Parameters:
x- string expressionpattern- string- Returns:
- like predicate
-
like
@Nonnull Predicate like(@Nonnull Expression<String> x, @Nonnull Expression<String> pattern, @Nonnull Expression<Character> escapeChar) Create a predicate for testing whether the expression satisfies the given pattern.- Parameters:
x- string expressionpattern- string expressionescapeChar- escape character expression- Returns:
- like predicate
-
like
@Nonnull Predicate like(@Nonnull Expression<String> x, @Nonnull Expression<String> pattern, char escapeChar) Create a predicate for testing whether the expression satisfies the given pattern.- Parameters:
x- string expressionpattern- string expressionescapeChar- escape character- Returns:
- like predicate
-
like
@Nonnull Predicate like(@Nonnull Expression<String> x, @Nonnull String pattern, @Nonnull Expression<Character> escapeChar) Create a predicate for testing whether the expression satisfies the given pattern.- Parameters:
x- string expressionpattern- stringescapeChar- escape character expression- Returns:
- like predicate
-
like
Create a predicate for testing whether the expression satisfies the given pattern.- Parameters:
x- string expressionpattern- stringescapeChar- escape character- Returns:
- like predicate
-
notLike
Create a predicate for testing whether the expression does not satisfy the given pattern.- Parameters:
x- string expressionpattern- string expression- Returns:
- not-like predicate
-
notLike
Create a predicate for testing whether the expression does not satisfy the given pattern.- Parameters:
x- string expressionpattern- string- Returns:
- not-like predicate
-
notLike
@Nonnull Predicate notLike(@Nonnull Expression<String> x, @Nonnull Expression<String> pattern, @Nonnull Expression<Character> escapeChar) Create a predicate for testing whether the expression does not satisfy the given pattern.- Parameters:
x- string expressionpattern- string expressionescapeChar- escape character expression- Returns:
- not-like predicate
-
notLike
@Nonnull Predicate notLike(@Nonnull Expression<String> x, @Nonnull Expression<String> pattern, char escapeChar) Create a predicate for testing whether the expression does not satisfy the given pattern.- Parameters:
x- string expressionpattern- string expressionescapeChar- escape character- Returns:
- not-like predicate
-
notLike
@Nonnull Predicate notLike(@Nonnull Expression<String> x, @Nonnull String pattern, @Nonnull Expression<Character> escapeChar) Create a predicate for testing whether the expression does not satisfy the given pattern.- Parameters:
x- string expressionpattern- stringescapeChar- escape character expression- Returns:
- not-like predicate
-
notLike
Create a predicate for testing whether the expression does not satisfy the given pattern.- Parameters:
x- string expressionpattern- stringescapeChar- escape character- Returns:
- not-like predicate
-
concat
Create an expression for string concatenation. If the given list of expressions is empty, returns an expression equivalent toliteral("").- Parameters:
expressions- string expressions- Returns:
- expression corresponding to concatenation
-
concat
Create an expression for string concatenation.- Parameters:
x- string expressiony- string expression- Returns:
- expression corresponding to concatenation
-
concat
Create an expression for string concatenation.- Parameters:
x- string expressiony- string- Returns:
- expression corresponding to concatenation
-
concat
Create an expression for string concatenation.- Parameters:
x- stringy- string expression- Returns:
- expression corresponding to concatenation
-
substring
@Nonnull Expression<String> substring(@Nonnull Expression<String> x, @Nonnull Expression<Integer> from) Create an expression for substring extraction. Extracts a substring starting at the specified position through to end of the string. First position is 1.- Parameters:
x- string expressionfrom- start position expression- Returns:
- expression corresponding to substring extraction
-
substring
Create an expression for substring extraction. Extracts a substring starting at the specified position through to end of the string. First position is 1.- Parameters:
x- string expressionfrom- start position- Returns:
- expression corresponding to substring extraction
-
substring
@Nonnull Expression<String> substring(@Nonnull Expression<String> x, @Nonnull Expression<Integer> from, @Nonnull Expression<Integer> len) Create an expression for substring extraction. Extracts a substring of given length starting at the specified position. First position is 1.- Parameters:
x- string expressionfrom- start position expressionlen- length expression- Returns:
- expression corresponding to substring extraction
-
substring
Create an expression for substring extraction. Extracts a substring of given length starting at the specified position. First position is 1.- Parameters:
x- string expressionfrom- start positionlen- length- Returns:
- expression corresponding to substring extraction
-
trim
Create expression to trim blanks from both ends of a string.- Parameters:
x- expression for string to trim- Returns:
- trim expression
-
trim
@Nonnull Expression<String> trim(@Nonnull CriteriaBuilder.Trimspec ts, @Nonnull Expression<String> x) Create expression to trim blanks from a string.- Parameters:
ts- trim specificationx- expression for string to trim- Returns:
- trim expression
-
trim
Create expression to trim character from both ends of a string.- Parameters:
t- expression for character to be trimmedx- expression for string to trim- Returns:
- trim expression
-
trim
@Nonnull Expression<String> trim(@Nonnull CriteriaBuilder.Trimspec ts, @Nonnull Expression<Character> t, @Nonnull Expression<String> x) Create expression to trim character from a string.- Parameters:
ts- trim specificationt- expression for character to be trimmedx- expression for string to trim- Returns:
- trim expression
-
trim
Create expression to trim character from both ends of a string.- Parameters:
t- character to be trimmedx- expression for string to trim- Returns:
- trim expression
-
trim
@Nonnull Expression<String> trim(@Nonnull CriteriaBuilder.Trimspec ts, char t, @Nonnull Expression<String> x) Create expression to trim character from a string.- Parameters:
ts- trim specificationt- character to be trimmedx- expression for string to trim- Returns:
- trim expression
-
lower
Create expression for converting a string to lowercase.- Parameters:
x- string expression- Returns:
- expression to convert to lowercase
-
upper
Create expression for converting a string to uppercase.- Parameters:
x- string expression- Returns:
- expression to convert to uppercase
-
length
Create expression to return length of a string.- Parameters:
x- string expression- Returns:
- length expression
-
left
Create an expression for the leftmost substring of a string,- Parameters:
x- string expressionlen- length of the substring to return- Returns:
- expression for the leftmost substring
-
right
Create an expression for the rightmost substring of a string,- Parameters:
x- string expressionlen- length of the substring to return- Returns:
- expression for the rightmost substring
-
left
Create an expression for the leftmost substring of a string,- Parameters:
x- string expressionlen- length of the substring to return- Returns:
- expression for the leftmost substring
-
right
Create an expression for the rightmost substring of a string,- Parameters:
x- string expressionlen- length of the substring to return- Returns:
- expression for the rightmost substring
-
replace
@Nonnull Expression<String> replace(@Nonnull Expression<String> x, @Nonnull Expression<String> substring, @Nonnull Expression<String> replacement) Create an expression replacing every occurrence of a substring within a string.- Parameters:
x- string expressionsubstring- the literal substring to replacereplacement- the replacement string- Returns:
- expression for the resulting string
-
replace
@Nonnull Expression<String> replace(@Nonnull Expression<String> x, @Nonnull String substring, @Nonnull Expression<String> replacement) Create an expression replacing every occurrence of a substring within a string.- Parameters:
x- string expressionsubstring- the literal substring to replacereplacement- the replacement string- Returns:
- expression for the resulting string
-
replace
@Nonnull Expression<String> replace(@Nonnull Expression<String> x, @Nonnull Expression<String> substring, @Nonnull String replacement) Create an expression replacing every occurrence of a substring within a string.- Parameters:
x- string expressionsubstring- the literal substring to replacereplacement- the replacement string- Returns:
- expression for the resulting string
-
replace
@Nonnull Expression<String> replace(@Nonnull Expression<String> x, @Nonnull String substring, @Nonnull String replacement) Create an expression replacing every occurrence of a substring within a string.- Parameters:
x- string expressionsubstring- the literal substring to replacereplacement- the replacement string- Returns:
- expression for the resulting string
-
locate
@Nonnull Expression<Integer> locate(@Nonnull Expression<String> x, @Nonnull Expression<String> pattern) Create expression to locate the position of one string within another, returning position of first character if found. The first position in a string is denoted by 1. If the string to be located is not found, 0 is returned.Warning: the order of the parameters of this method is reversed compared to the corresponding function in JPQL.
- Parameters:
x- expression for string to be searchedpattern- expression for string to be located- Returns:
- expression corresponding to position
-
locate
Create expression to locate the position of one string within another, returning position of first character if found. The first position in a string is denoted by 1. If the string to be located is not found, 0 is returned.Warning: the order of the parameters of this method is reversed compared to the corresponding function in JPQL.
- Parameters:
x- expression for string to be searchedpattern- string to be located- Returns:
- expression corresponding to position
-
locate
@Nonnull Expression<Integer> locate(@Nonnull Expression<String> x, @Nonnull Expression<String> pattern, @Nonnull Expression<Integer> from) Create expression to locate the position of one string within another, returning position of first character if found. The first position in a string is denoted by 1. If the string to be located is not found, 0 is returned.Warning: the order of the first two parameters of this method is reversed compared to the corresponding function in JPQL.
- Parameters:
x- expression for string to be searchedpattern- expression for string to be locatedfrom- expression for position at which to start search- Returns:
- expression corresponding to position
-
locate
@Nonnull Expression<Integer> locate(@Nonnull Expression<String> x, @Nonnull String pattern, int from) Create expression to locate the position of one string within another, returning position of first character if found. The first position in a string is denoted by 1. If the string to be located is not found, 0 is returned.Warning: the order of the first two parameters of this method is reversed compared to the corresponding function in JPQL.
- Parameters:
x- expression for string to be searchedpattern- string to be locatedfrom- position at which to start search- Returns:
- expression corresponding to position
-
currentDate
Create expression to return current date.- Returns:
- expression for current date
-
currentTimestamp
Create expression to return current timestamp.- Returns:
- expression for current timestamp
-
currentTime
Create expression to return current time.- Returns:
- expression for current time
-
localDate
Create expression to return current local date.- Returns:
- expression for current date
-
localDateTime
Create expression to return current local datetime.- Returns:
- expression for current timestamp
-
localTime
Create expression to return current local time.- Returns:
- expression for current time
-
extract
@Nonnull <N, T extends Temporal> Expression<N> extract(@Nonnull TemporalField<N, T> field, @Nonnull Expression<T> temporal) Create an expression that returns the value of a field extracted from a date, time, or datetime.- Type Parameters:
N- the type of the extracted valueT- the temporal type- Parameters:
field- a temporal field typetemporal- a date, time, or datetime- Returns:
- expression for the value of the extracted field
- Since:
- 3.2
-
in
Create predicate to test whether given expression is contained in a list of values.- Type Parameters:
T- the type of the expression- Parameters:
expression- to be tested against list of values- Returns:
- in predicate
-
coalesce
@Nonnull <Y> Expression<Y> coalesce(@Nonnull Expression<? extends Y> x, @Nonnull Expression<? extends Y> y) Create an expression that returns null if all its arguments evaluate to null, and the value of the first non-null argument otherwise.- Type Parameters:
Y- the type of the expression- Parameters:
x- expressiony- expression- Returns:
- coalesce expression
-
coalesce
Create an expression that returns null if all its arguments evaluate to null, and the value of the first non-null argument otherwise.- Type Parameters:
Y- the type of the expression- Parameters:
x- expressiony- value- Returns:
- coalesce expression
-
nullif
Create an expression that tests whether its argument are equal, returning null if they are and the value of the first expression if they are not.- Type Parameters:
Y- the type of the expression- Parameters:
x- expressiony- expression- Returns:
- nullif expression
-
nullif
Create an expression that tests whether its argument are equal, returning null if they are and the value of the first expression if they are not.- Type Parameters:
Y- the type of the expression- Parameters:
x- expressiony- value- Returns:
- nullif expression
-
coalesce
Create a coalesce expression.- Type Parameters:
T- the type of the coalesce expression- Returns:
- coalesce expression
-
selectCase
@Nonnull <C,R> CriteriaBuilder.SimpleCase<C,R> selectCase(@Nonnull Expression<? extends C> expression, @Nonnull Class<R> type) Create a simple case expression.- Parameters:
expression- to be tested against the case conditionstype- the type of the result of the case expression- Returns:
- simple case expression
-
selectCase
@Deprecated(since="4.0") @Nonnull <C,R> CriteriaBuilder.SimpleCase<C,R> selectCase(@Nonnull Expression<? extends C> expression) Deprecated.This operation declares an unconstrained type variable. UseselectCase(Expression,Class)instead.Create a simple case expression.- Type Parameters:
C- the type of the case expressionR- the result type of the case expression- Parameters:
expression- to be tested against the case conditions- Returns:
- simple case expression
-
selectCase
Create a general case expression.- Parameters:
type- the type of the result of the case expression- Returns:
- general case expression
-
selectCase
Deprecated.This operation declares an unconstrained type variable. UseselectCase(Class)instead.Create a general case expression.- Type Parameters:
R- the result type of the case expression- Returns:
- general case expression
-
function
@Nonnull <T> Expression<T> function(@Nonnull String name, @Nonnull Class<T> type, @Nonnull Expression<?>... args) Create an expression for the execution of the database function with the given name.- Type Parameters:
T- the function result type- Parameters:
name- function nametype- expected result typeargs- function arguments- Returns:
- expression
- API note:
- This operation allows invocation of arbitrary SQL functions. The persistence provider is permitted to pass the given function name verbatim to the database, with no additional validation or sanitization. Therefore, the client must never pass unvalidated user input nor any other untrusted string value to the first parameter of this method.
-
treat
Downcast Join object to the specified type.- Type Parameters:
X- the source type of the joinT- the target type of the joinV- the subtype to treat the join as- Parameters:
join- Join objecttype- type to be downcast to- Returns:
- Join object of the specified type
- Since:
- 2.1
-
treat
@Nonnull <X, T, E extends T> CollectionJoin<X,E> treat(@Nonnull CollectionJoin<X, T> join, @Nonnull Class<E> type) Downcast CollectionJoin object to the specified type.- Type Parameters:
X- the source type of the joinT- the element type of the joinE- the subtype to treat the join as- Parameters:
join- CollectionJoin objecttype- type to be downcast to- Returns:
- CollectionJoin object of the specified type
- Since:
- 2.1
-
treat
Downcast SetJoin object to the specified type.- Type Parameters:
X- the source type of the joinT- the element type of the joinE- the subtype to treat the join as- Parameters:
join- SetJoin objecttype- type to be downcast to- Returns:
- SetJoin object of the specified type
- Since:
- 2.1
-
treat
@Nonnull <X, T, E extends T> ListJoin<X,E> treat(@Nonnull ListJoin<X, T> join, @Nonnull Class<E> type) Downcast ListJoin object to the specified type.- Type Parameters:
X- the source type of the joinT- the element type of the joinE- the subtype to treat the join as- Parameters:
join- ListJoin objecttype- type to be downcast to- Returns:
- ListJoin object of the specified type
- Since:
- 2.1
-
treat
@Nonnull <X, K, T, V extends T> MapJoin<X,K, treatV> (@Nonnull MapJoin<X, K, T> join, @Nonnull Class<V> type) Downcast MapJoin object to the specified type.- Type Parameters:
X- the source type of the joinK- the key type of the joinT- the value type of the joinV- the subtype to treat the join as- Parameters:
join- MapJoin objecttype- type to be downcast to- Returns:
- MapJoin object of the specified type
- Since:
- 2.1
-
treat
Downcast Path object to the specified type.- Type Parameters:
X- the type of the pathT- the subtype to treat the path as- Parameters:
path- pathtype- type to be downcast to- Returns:
- Path object of the specified type
- Since:
- 2.1
-
treat
Downcast Root or Join to the specified type.- Type Parameters:
X- the source typeY- the target typeT- the subtype to treat the root or join as- Parameters:
from- root or jointype- type to be downcast to- Returns:
- Root or Join of the specified type
- Since:
- 4.0
-
treat
Downcast Root object to the specified type.- Type Parameters:
X- the type of the rootT- the subtype to treat the root as- Parameters:
root- roottype- type to be downcast to- Returns:
- Root object of the specified type
- Since:
- 2.1
-
union
@Nonnull <T> CriteriaSelect<T> union(@Nonnull CriteriaSelect<? extends T> left, @Nonnull CriteriaSelect<? extends T> right) Create a query which is the union of the given queries.- Type Parameters:
T- the result type of the query- Returns:
- a new criteria query which returns the union of the results of the given queries
- Since:
- 3.2
-
unionAll
@Nonnull <T> CriteriaSelect<T> unionAll(@Nonnull CriteriaSelect<? extends T> left, @Nonnull CriteriaSelect<? extends T> right) Create a query which is the union of the given queries, without elimination of duplicate results.- Type Parameters:
T- the result type of the query- Returns:
- a new criteria query which returns the union of the results of the given queries
- Since:
- 3.2
-
intersect
@Nonnull <T> CriteriaSelect<T> intersect(@Nonnull CriteriaSelect<? super T> left, @Nonnull CriteriaSelect<? super T> right) Create a query which is the intersection of the given queries.- Type Parameters:
T- the result type of the query- Returns:
- a new criteria query which returns the intersection of the results of the given queries
- Since:
- 3.2
-
intersectAll
@Nonnull <T> CriteriaSelect<T> intersectAll(@Nonnull CriteriaSelect<? super T> left, @Nonnull CriteriaSelect<? super T> right) Create a query which is the intersection of the given queries, without elimination of duplicate results.- Type Parameters:
T- the result type of the query- Returns:
- a new criteria query which returns the intersection of the results of the given queries
- Since:
- 3.2
-
except
@Nonnull <T> CriteriaSelect<T> except(@Nonnull CriteriaSelect<T> left, @Nonnull CriteriaSelect<?> right) Create a query by (setwise) subtraction of the second query from the first query.- Type Parameters:
T- the result type of the query- Returns:
- a new criteria query which returns the result of subtracting the results of the second query from the results of the first query
- Since:
- 3.2
-
exceptAll
@Nonnull <T> CriteriaSelect<T> exceptAll(@Nonnull CriteriaSelect<T> left, @Nonnull CriteriaSelect<?> right) Create a query by (setwise) subtraction of the second query from the first query, without elimination of duplicate results.- Type Parameters:
T- the result type of the query- Returns:
- a new criteria query which returns the result of subtracting the results of the second query from the results of the first query
- Since:
- 3.2
-