Package jakarta.persistence.criteria
Interface CriteriaBuilder
-
public interface CriteriaBuilder
Used to construct criteria queries, compound selections, expressions, predicates, orderings.Note that
Predicate
is used instead ofExpression<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 Classes Modifier and Type Interface Description static interface
CriteriaBuilder.Case<R>
Interface used to build general case expressions.static interface
CriteriaBuilder.Coalesce<T>
Interface used to build coalesce expressions.static interface
CriteriaBuilder.In<T>
Interface used to build in predicates.static interface
CriteriaBuilder.SimpleCase<C,R>
Interface used to build simple case expressions.static class
CriteriaBuilder.Trimspec
Used to specify how strings are trimmed.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <N extends Number>
Expression<N>abs(Expression<N> x)
Create an expression that returns the absolute value of its argument.<Y> Expression<Y>
all(Subquery<Y> subquery)
Create an all expression over the subquery results.Predicate
and(Expression<Boolean> x, Expression<Boolean> y)
Create a conjunction of the given boolean expressions.Predicate
and(Predicate... restrictions)
Create a conjunction of the given restriction predicates.<Y> Expression<Y>
any(Subquery<Y> subquery)
Create an any expression over the subquery results.CompoundSelection<Object[]>
array(Selection<?>... selections)
Create an array-valued selection item.Order
asc(Expression<?> x)
Create an ordering by the ascending value of the expression.<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.<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.Expression<String>
concat(Expression<String> x, Expression<String> y)
Create an expression for string concatenation.Expression<String>
concat(Expression<String> x, String y)
Create an expression for string concatenation.Expression<String>
concat(String x, Expression<String> y)
Create an expression for string concatenation.Predicate
conjunction()
Create a conjunction (with zero conjuncts).<Y> CompoundSelection<Y>
construct(Class<Y> resultClass, Selection<?>... selections)
Create a selection item corresponding to a constructor.Expression<Long>
count(Expression<?> x)
Create an aggregate expression applying the count operation.Expression<Long>
countDistinct(Expression<?> x)
Create an aggregate expression applying the count distinct operation.<T> CriteriaDelete<T>
createCriteriaDelete(Class<T> targetEntity)
Create aCriteriaDelete
query object to perform a bulk delete operation.<T> CriteriaUpdate<T>
createCriteriaUpdate(Class<T> targetEntity)
Create aCriteriaUpdate
query object to perform a bulk update operation.CriteriaQuery<Object>
createQuery()
Create aCriteriaQuery
object.<T> CriteriaQuery<T>
createQuery(Class<T> resultClass)
Create aCriteriaQuery
object with the specified result type.CriteriaQuery<Tuple>
createTupleQuery()
Create aCriteriaQuery
object that returns a tuple of objects as its result.Expression<Date>
currentDate()
Create expression to return current date.Expression<Time>
currentTime()
Create expression to return current time.Expression<Timestamp>
currentTimestamp()
Create expression to return current timestamp.Order
desc(Expression<?> x)
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.Predicate
disjunction()
Create a disjunction (with zero disjuncts).Predicate
equal(Expression<?> x, Expression<?> y)
Create a predicate for testing the arguments for equality.Predicate
equal(Expression<?> x, Object y)
Create a predicate for testing the arguments for equality.Predicate
exists(Subquery<?> subquery)
Create a predicate testing the existence of a subquery result.Expression<Double>
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 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 a database function.Predicate
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.Predicate
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).Predicate
gt(Expression<? extends Number> x, Expression<? extends Number> y)
Create a predicate for testing whether the first argument is greater than the second.Predicate
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.<C extends Collection<?>>
PredicateisEmpty(Expression<C> collection)
Create a predicate that tests whether a collection is empty.Predicate
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.Predicate
isNotNull(Expression<?> x)
Create a predicate to test whether the expression is not null.Predicate
isNull(Expression<?> x)
Create a predicate to test whether the expression is null.Predicate
isTrue(Expression<Boolean> x)
Create a predicate testing for a true value.<K,M extends Map<K,?>>
Expression<Set<K>>keys(M map)
Create an expression that returns the keys of a map.Predicate
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.Predicate
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).Expression<Integer>
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.Predicate
like(Expression<String> x, Expression<String> pattern)
Create a predicate for testing whether the expression satisfies the given pattern.Predicate
like(Expression<String> x, Expression<String> pattern, char escapeChar)
Create a predicate for testing whether the expression satisfies the given pattern.Predicate
like(Expression<String> x, Expression<String> pattern, Expression<Character> escapeChar)
Create a predicate for testing whether the expression satisfies the given pattern.Predicate
like(Expression<String> x, String pattern)
Create a predicate for testing whether the expression satisfies the given pattern.Predicate
like(Expression<String> x, String pattern, char escapeChar)
Create a predicate for testing whether the expression satisfies the given pattern.Predicate
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.Expression<Double>
ln(Expression<? extends Number> x)
Create an expression that returns the natural logarithm of its argument.Expression<LocalDate>
localDate()
Create expression to return current local date.Expression<LocalDateTime>
localDateTime()
Create expression to return current local datetime.Expression<LocalTime>
localTime()
Create expression to return current local time.Expression<Integer>
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.Expression<Integer>
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.Expression<Integer>
locate(Expression<String> x, String pattern)
Create expression to locate the position of one string within another, returning position of first character if found.Expression<Integer>
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.Expression<String>
lower(Expression<String> x)
Create expression for converting a string to lowercase.Predicate
lt(Expression<? extends Number> x, Expression<? extends Number> y)
Create a predicate for testing whether the first argument is less than the second.Predicate
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.Expression<Integer>
mod(Expression<Integer> x, Expression<Integer> y)
Create an expression that returns the modulus (remainder under integer division) of its arguments.Expression<Integer>
mod(Expression<Integer> x, Integer y)
Create an expression that returns the modulus (remainder under integer division) of its arguments.Expression<Integer>
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.Predicate
not(Expression<Boolean> restriction)
Create a negation of the given restriction.Predicate
notEqual(Expression<?> x, Expression<?> y)
Create a predicate for testing the arguments for inequality.Predicate
notEqual(Expression<?> x, Object y)
Create a predicate for testing the arguments for inequality.Predicate
notLike(Expression<String> x, Expression<String> pattern)
Create a predicate for testing whether the expression does not satisfy the given pattern.Predicate
notLike(Expression<String> x, Expression<String> pattern, char escapeChar)
Create a predicate for testing whether the expression does not satisfy the given pattern.Predicate
notLike(Expression<String> x, Expression<String> pattern, Expression<Character> escapeChar)
Create a predicate for testing whether the expression does not satisfy the given pattern.Predicate
notLike(Expression<String> x, String pattern)
Create a predicate for testing whether the expression does not satisfy the given pattern.Predicate
notLike(Expression<String> x, String pattern, char escapeChar)
Create a predicate for testing whether the expression does not satisfy the given pattern.Predicate
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.Predicate
or(Expression<Boolean> x, Expression<Boolean> y)
Create a disjunction of the given boolean expressions.Predicate
or(Predicate... restrictions)
Create a disjunction of the given restriction predicates.<T> ParameterExpression<T>
parameter(Class<T> paramClass)
Create a parameter expression.<T> ParameterExpression<T>
parameter(Class<T> paramClass, String name)
Create a parameter expression with the given name.Expression<Double>
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.Expression<Double>
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.Expression<Number>
quot(Expression<? extends Number> x, Expression<? extends Number> y)
Create an expression that returns the quotient of its arguments.Expression<Number>
quot(Expression<? extends Number> x, Number y)
Create an expression that returns the quotient of its arguments.Expression<Number>
quot(Number x, Expression<? extends Number> y)
Create an expression that returns the quotient of its arguments.<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>
selectCase()
Create a general case expression.<C,R>
CriteriaBuilder.SimpleCase<C,R>selectCase(Expression<? extends C> expression)
Create a simple case expression.Expression<Integer>
sign(Expression<? extends Number> x)
Create an expression that returns the sign of its argument, that is,1
if its argument is positive,-1
if its argument is negative, or0
if 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>
some(Subquery<Y> subquery)
Create a some expression over the subquery results.Expression<Double>
sqrt(Expression<? extends Number> x)
Create an expression that returns the square root of its argument.Expression<String>
substring(Expression<String> x, int from)
Create an expression for substring extraction.Expression<String>
substring(Expression<String> x, int from, int len)
Create an expression for substring extraction.Expression<String>
substring(Expression<String> x, Expression<Integer> from)
Create an expression for substring extraction.Expression<String>
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.Expression<Double>
sumAsDouble(Expression<Float> x)
Create an aggregate expression applying the sum operation to a Float-valued expression, returning a Double result.Expression<Long>
sumAsLong(Expression<Integer> x)
Create an aggregate expression applying the sum operation to an Integer-valued expression, returning a Long result.Expression<BigDecimal>
toBigDecimal(Expression<? extends Number> number)
Typecast.Expression<BigInteger>
toBigInteger(Expression<? extends Number> number)
Typecast.Expression<Double>
toDouble(Expression<? extends Number> number)
Typecast.Expression<Float>
toFloat(Expression<? extends Number> number)
Typecast.Expression<Integer>
toInteger(Expression<? extends Number> number)
Typecast.Expression<Long>
toLong(Expression<? extends Number> number)
Typecast.Expression<String>
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,T,V extends T>
Join<X,V>treat(Join<X,T> join, Class<V> type)
Downcast Join object to the specified type.<X,T,E extends T>
ListJoin<X,E>treat(ListJoin<X,T> join, Class<E> type)
Downcast ListJoin object to the specified type.<X,K,T,V extends T>
MapJoin<X,K,V>treat(MapJoin<X,K,T> join, Class<V> type)
Downcast MapJoin object to the specified type.<X,T extends X>
Path<T>treat(Path<X> path, Class<T> type)
Downcast Path object to the specified type.<X,T extends X>
Root<T>treat(Root<X> root, Class<T> type)
Downcast Root object to the specified type.<X,T,E extends T>
SetJoin<X,E>treat(SetJoin<X,T> join, Class<E> type)
Downcast SetJoin object to the specified type.Expression<String>
trim(char t, Expression<String> x)
Create expression to trim character from both ends of a string.Expression<String>
trim(CriteriaBuilder.Trimspec ts, char t, Expression<String> x)
Create expression to trim character from a string.Expression<String>
trim(CriteriaBuilder.Trimspec ts, Expression<Character> t, Expression<String> x)
Create expression to trim character from a string.Expression<String>
trim(CriteriaBuilder.Trimspec ts, Expression<String> x)
Create expression to trim blanks from a string.Expression<String>
trim(Expression<Character> t, Expression<String> x)
Create expression to trim character from both ends of a string.Expression<String>
trim(Expression<String> x)
Create expression to trim blanks from both ends of a string.CompoundSelection<Tuple>
tuple(Selection<?>... selections)
Create a tuple-valued selection item.Expression<String>
upper(Expression<String> x)
Create expression for converting a string to uppercase.<V,M extends Map<?,V>>
Expression<Collection<V>>values(M map)
Create an expression that returns the values of a map.
-
-
-
Method Detail
-
createQuery
CriteriaQuery<Object> createQuery()
Create aCriteriaQuery
object.- Returns:
- criteria query object
-
createQuery
<T> CriteriaQuery<T> createQuery(Class<T> resultClass)
Create aCriteriaQuery
object with the specified result type.- Parameters:
resultClass
- type of the query result- Returns:
- criteria query object
-
createTupleQuery
CriteriaQuery<Tuple> createTupleQuery()
Create aCriteriaQuery
object that returns a tuple of objects as its result.- Returns:
- criteria query object
-
createCriteriaUpdate
<T> CriteriaUpdate<T> createCriteriaUpdate(Class<T> targetEntity)
Create aCriteriaUpdate
query object to perform a bulk update operation.- Parameters:
targetEntity
- target type for update operation- Returns:
- the query object
- Since:
- 2.1
-
createCriteriaDelete
<T> CriteriaDelete<T> createCriteriaDelete(Class<T> targetEntity)
Create aCriteriaDelete
query object to perform a bulk delete operation.- Parameters:
targetEntity
- target type for delete operation- Returns:
- the query object
- Since:
- 2.1
-
construct
<Y> CompoundSelection<Y> construct(Class<Y> resultClass, Selection<?>... selections)
Create a selection item corresponding to a constructor. This method is used to specify a constructor that will be 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.- 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
CompoundSelection<Tuple> tuple(Selection<?>... selections)
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
-
array
CompoundSelection<Object[]> array(Selection<?>... selections)
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
-
asc
Order asc(Expression<?> x)
Create an ordering by the ascending value of the expression.- Parameters:
x
- expression used to define the ordering- Returns:
- ascending ordering corresponding to the expression
-
desc
Order desc(Expression<?> x)
Create an ordering by the descending value of the expression.- Parameters:
x
- expression used to define the ordering- Returns:
- descending ordering corresponding to the expression
-
avg
<N extends Number> Expression<Double> avg(Expression<N> x)
Create an aggregate expression applying the avg operation.- Parameters:
x
- expression representing input value to avg operation- Returns:
- avg expression
-
sum
<N extends Number> Expression<N> sum(Expression<N> x)
Create an aggregate expression applying the sum operation.- Parameters:
x
- expression representing input value to sum operation- Returns:
- sum expression
-
sumAsLong
Expression<Long> sumAsLong(Expression<Integer> x)
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
Expression<Double> sumAsDouble(Expression<Float> x)
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
<N extends Number> Expression<N> max(Expression<N> x)
Create an aggregate expression applying the numerical max operation.- Parameters:
x
- expression representing input value to max operation- Returns:
- max expression
-
min
<N extends Number> Expression<N> min(Expression<N> x)
Create an aggregate expression applying the numerical min operation.- Parameters:
x
- expression representing input value to min operation- Returns:
- min expression
-
greatest
<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).- Parameters:
x
- expression representing input value to greatest operation- Returns:
- greatest expression
-
least
<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).- Parameters:
x
- expression representing input value to least operation- Returns:
- least expression
-
count
Expression<Long> count(Expression<?> x)
Create an aggregate expression applying the count operation.- Parameters:
x
- expression representing input value to count operation- Returns:
- count expression
-
countDistinct
Expression<Long> countDistinct(Expression<?> x)
Create an aggregate expression applying the count distinct operation.- Parameters:
x
- expression representing input value to count distinct operation- Returns:
- count distinct expression
-
exists
Predicate exists(Subquery<?> subquery)
Create a predicate testing the existence of a subquery result.- Parameters:
subquery
- subquery whose result is to be tested- Returns:
- exists predicate
-
all
<Y> Expression<Y> all(Subquery<Y> subquery)
Create an all expression over the subquery results.- Parameters:
subquery
- subquery- Returns:
- all expression
-
some
<Y> Expression<Y> some(Subquery<Y> subquery)
Create a some expression over the subquery results. This expression is equivalent to anany
expression.- Parameters:
subquery
- subquery- Returns:
- some expression
-
any
<Y> Expression<Y> any(Subquery<Y> subquery)
Create an any expression over the subquery results. This expression is equivalent to asome
expression.- Parameters:
subquery
- subquery- Returns:
- any expression
-
and
Predicate and(Expression<Boolean> x, Expression<Boolean> y)
Create a conjunction of the given boolean expressions.- Parameters:
x
- boolean expressiony
- boolean expression- Returns:
- and predicate
-
and
Predicate and(Predicate... restrictions)
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
-
or
Predicate or(Expression<Boolean> x, Expression<Boolean> y)
Create a disjunction of the given boolean expressions.- Parameters:
x
- boolean expressiony
- boolean expression- Returns:
- or predicate
-
or
Predicate or(Predicate... restrictions)
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
-
not
Predicate not(Expression<Boolean> restriction)
Create a negation of the given restriction.- Parameters:
restriction
- restriction expression- Returns:
- not predicate
-
conjunction
Predicate conjunction()
Create a conjunction (with zero conjuncts). A conjunction with zero conjuncts is true.- Returns:
- and predicate
-
disjunction
Predicate disjunction()
Create a disjunction (with zero disjuncts). A disjunction with zero disjuncts is false.- Returns:
- or predicate
-
isTrue
Predicate isTrue(Expression<Boolean> x)
Create a predicate testing for a true value.- Parameters:
x
- expression to be tested- Returns:
- predicate
-
isFalse
Predicate isFalse(Expression<Boolean> x)
Create a predicate testing for a false value.- Parameters:
x
- expression to be tested- Returns:
- predicate
-
isNull
Predicate isNull(Expression<?> x)
Create a predicate to test whether the expression is null.- Parameters:
x
- expression- Returns:
- is-null predicate
-
isNotNull
Predicate isNotNull(Expression<?> x)
Create a predicate to test whether the expression is not null.- Parameters:
x
- expression- Returns:
- is-not-null predicate
-
equal
Predicate equal(Expression<?> x, Expression<?> y)
Create a predicate for testing the arguments for equality.- Parameters:
x
- expressiony
- expression- Returns:
- equality predicate
-
equal
Predicate equal(Expression<?> x, Object y)
Create a predicate for testing the arguments for equality.- Parameters:
x
- expressiony
- object- Returns:
- equality predicate
-
notEqual
Predicate notEqual(Expression<?> x, Expression<?> y)
Create a predicate for testing the arguments for inequality.- Parameters:
x
- expressiony
- expression- Returns:
- inequality predicate
-
notEqual
Predicate notEqual(Expression<?> x, Object y)
Create a predicate for testing the arguments for inequality.- Parameters:
x
- expressiony
- object- Returns:
- inequality predicate
-
greaterThan
<Y extends Comparable<? super Y>> Predicate greaterThan(Expression<? extends Y> x, Expression<? extends Y> y)
Create a predicate for testing whether the first argument is greater than the second.- Parameters:
x
- expressiony
- expression- Returns:
- greater-than predicate
-
greaterThan
<Y extends Comparable<? super Y>> Predicate greaterThan(Expression<? extends Y> x, Y y)
Create a predicate for testing whether the first argument is greater than the second.- Parameters:
x
- expressiony
- value- Returns:
- greater-than predicate
-
greaterThanOrEqualTo
<Y extends Comparable<? super Y>> Predicate greaterThanOrEqualTo(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.- Parameters:
x
- expressiony
- expression- Returns:
- greater-than-or-equal predicate
-
greaterThanOrEqualTo
<Y extends Comparable<? super Y>> Predicate greaterThanOrEqualTo(Expression<? extends Y> x, Y y)
Create a predicate for testing whether the first argument is greater than or equal to the second.- Parameters:
x
- expressiony
- value- Returns:
- greater-than-or-equal predicate
-
lessThan
<Y extends Comparable<? super Y>> Predicate lessThan(Expression<? extends Y> x, Expression<? extends Y> y)
Create a predicate for testing whether the first argument is less than the second.- Parameters:
x
- expressiony
- expression- Returns:
- less-than predicate
-
lessThan
<Y extends Comparable<? super Y>> Predicate lessThan(Expression<? extends Y> x, Y y)
Create a predicate for testing whether the first argument is less than the second.- Parameters:
x
- expressiony
- value- Returns:
- less-than predicate
-
lessThanOrEqualTo
<Y extends Comparable<? super Y>> Predicate lessThanOrEqualTo(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.- Parameters:
x
- expressiony
- expression- Returns:
- less-than-or-equal predicate
-
lessThanOrEqualTo
<Y extends Comparable<? super Y>> Predicate lessThanOrEqualTo(Expression<? extends Y> x, Y y)
Create a predicate for testing whether the first argument is less than or equal to the second.- Parameters:
x
- expressiony
- value- Returns:
- less-than-or-equal predicate
-
between
<Y extends Comparable<? super Y>> Predicate between(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.- Parameters:
v
- expressionx
- expressiony
- expression- Returns:
- between predicate
-
between
<Y extends Comparable<? super Y>> Predicate between(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.- Parameters:
v
- expressionx
- valuey
- value- Returns:
- between predicate
-
gt
Predicate gt(Expression<? extends Number> x, Expression<? extends Number> y)
Create a predicate for testing whether the first argument is greater than the second.- Parameters:
x
- expressiony
- expression- Returns:
- greater-than predicate
-
gt
Predicate gt(Expression<? extends Number> x, Number y)
Create a predicate for testing whether the first argument is greater than the second.- Parameters:
x
- expressiony
- value- Returns:
- greater-than predicate
-
ge
Predicate 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.- Parameters:
x
- expressiony
- expression- Returns:
- greater-than-or-equal predicate
-
ge
Predicate ge(Expression<? extends Number> x, Number y)
Create a predicate for testing whether the first argument is greater than or equal to the second.- Parameters:
x
- expressiony
- value- Returns:
- greater-than-or-equal predicate
-
lt
Predicate lt(Expression<? extends Number> x, Expression<? extends Number> y)
Create a predicate for testing whether the first argument is less than the second.- Parameters:
x
- expressiony
- expression- Returns:
- less-than predicate
-
lt
Predicate lt(Expression<? extends Number> x, Number y)
Create a predicate for testing whether the first argument is less than the second.- Parameters:
x
- expressiony
- value- Returns:
- less-than predicate
-
le
Predicate 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.- Parameters:
x
- expressiony
- expression- Returns:
- less-than-or-equal predicate
-
le
Predicate le(Expression<? extends Number> x, Number y)
Create a predicate for testing whether the first argument is less than or equal to the second.- Parameters:
x
- expressiony
- value- Returns:
- less-than-or-equal predicate
-
sign
Expression<Integer> sign(Expression<? extends Number> x)
Create an expression that returns the sign of its argument, that is,1
if its argument is positive,-1
if its argument is negative, or0
if its argument is exactly zero.- Parameters:
x
- expression- Returns:
- sign
-
neg
<N extends Number> Expression<N> neg(Expression<N> x)
Create an expression that returns the arithmetic negation of its argument.- Parameters:
x
- expression- Returns:
- arithmetic negation
-
abs
<N extends Number> Expression<N> abs(Expression<N> x)
Create an expression that returns the absolute value of its argument.- Parameters:
x
- expression- Returns:
- absolute value
-
ceiling
<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.- Parameters:
x
- expression- Returns:
- ceiling
-
floor
<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.- Parameters:
x
- expression- Returns:
- floor
-
sum
<N extends Number> Expression<N> sum(Expression<? extends N> x, Expression<? extends N> y)
Create an expression that returns the sum of its arguments.- Parameters:
x
- expressiony
- expression- Returns:
- sum
-
sum
<N extends Number> Expression<N> sum(Expression<? extends N> x, N y)
Create an expression that returns the sum of its arguments.- Parameters:
x
- expressiony
- value- Returns:
- sum
-
sum
<N extends Number> Expression<N> sum(N x, Expression<? extends N> y)
Create an expression that returns the sum of its arguments.- Parameters:
x
- valuey
- expression- Returns:
- sum
-
prod
<N extends Number> Expression<N> prod(Expression<? extends N> x, Expression<? extends N> y)
Create an expression that returns the product of its arguments.- Parameters:
x
- expressiony
- expression- Returns:
- product
-
prod
<N extends Number> Expression<N> prod(Expression<? extends N> x, N y)
Create an expression that returns the product of its arguments.- Parameters:
x
- expressiony
- value- Returns:
- product
-
prod
<N extends Number> Expression<N> prod(N x, Expression<? extends N> y)
Create an expression that returns the product of its arguments.- Parameters:
x
- valuey
- expression- Returns:
- product
-
diff
<N extends Number> Expression<N> diff(Expression<? extends N> x, Expression<? extends N> y)
Create an expression that returns the difference between its arguments.- Parameters:
x
- expressiony
- expression- Returns:
- difference
-
diff
<N extends Number> Expression<N> diff(Expression<? extends N> x, N y)
Create an expression that returns the difference between its arguments.- Parameters:
x
- expressiony
- value- Returns:
- difference
-
diff
<N extends Number> Expression<N> diff(N x, Expression<? extends N> y)
Create an expression that returns the difference between its arguments.- Parameters:
x
- valuey
- expression- Returns:
- difference
-
quot
Expression<Number> quot(Expression<? extends Number> x, Expression<? extends Number> y)
Create an expression that returns the quotient of its arguments.- Parameters:
x
- expressiony
- expression- Returns:
- quotient
-
quot
Expression<Number> quot(Expression<? extends Number> x, Number y)
Create an expression that returns the quotient of its arguments.- Parameters:
x
- expressiony
- value- Returns:
- quotient
-
quot
Expression<Number> quot(Number x, Expression<? extends Number> y)
Create an expression that returns the quotient of its arguments.- Parameters:
x
- valuey
- expression- Returns:
- quotient
-
mod
Expression<Integer> mod(Expression<Integer> x, Expression<Integer> y)
Create an expression that returns the modulus (remainder under integer division) of its arguments.- Parameters:
x
- expressiony
- expression- Returns:
- modulus
-
mod
Expression<Integer> mod(Expression<Integer> x, Integer y)
Create an expression that returns the modulus (remainder under integer division) of its arguments.- Parameters:
x
- expressiony
- value- Returns:
- modulus
-
mod
Expression<Integer> mod(Integer x, Expression<Integer> y)
Create an expression that returns the modulus (remainder under integer division) of its arguments.- Parameters:
x
- valuey
- expression- Returns:
- modulus
-
sqrt
Expression<Double> sqrt(Expression<? extends Number> x)
Create an expression that returns the square root of its argument.- Parameters:
x
- expression- Returns:
- square root
-
exp
Expression<Double> 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.- Parameters:
x
- expression- Returns:
- exponential
-
ln
Expression<Double> ln(Expression<? extends Number> x)
Create an expression that returns the natural logarithm of its argument.- Parameters:
x
- expression- Returns:
- natural logarithm
-
power
Expression<Double> 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.- Parameters:
x
- basey
- exponent- Returns:
- the base raised to the power of the exponent
-
power
Expression<Double> power(Expression<? extends Number> x, 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
-
round
<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.- Parameters:
x
- basen
- number of decimal places- Returns:
- the rounded value
-
toLong
Expression<Long> toLong(Expression<? extends Number> number)
Typecast. Returns same expression object.- Parameters:
number
- numeric expression- Returns:
- Expression<Long>
-
toInteger
Expression<Integer> toInteger(Expression<? extends Number> number)
Typecast. Returns same expression object.- Parameters:
number
- numeric expression- Returns:
- Expression<Integer>
-
toFloat
Expression<Float> toFloat(Expression<? extends Number> number)
Typecast. Returns same expression object.- Parameters:
number
- numeric expression- Returns:
- Expression<Float>
-
toDouble
Expression<Double> toDouble(Expression<? extends Number> number)
Typecast. Returns same expression object.- Parameters:
number
- numeric expression- Returns:
- Expression<Double>
-
toBigDecimal
Expression<BigDecimal> toBigDecimal(Expression<? extends Number> number)
Typecast. Returns same expression object.- Parameters:
number
- numeric expression- Returns:
- Expression<BigDecimal>
-
toBigInteger
Expression<BigInteger> toBigInteger(Expression<? extends Number> number)
Typecast. Returns same expression object.- Parameters:
number
- numeric expression- Returns:
- Expression<BigInteger>
-
toString
Expression<String> toString(Expression<Character> character)
Typecast. Returns same expression object.- Parameters:
character
- expression- Returns:
- Expression<String>
-
literal
<T> Expression<T> literal(T value)
Create an expression for a literal.- Parameters:
value
- value represented by the expression- Returns:
- expression literal
- Throws:
IllegalArgumentException
- if value is null
-
nullLiteral
<T> Expression<T> nullLiteral(Class<T> resultClass)
Create an expression for a null literal with the given type.- Parameters:
resultClass
- type of the null literal- Returns:
- null expression literal
-
parameter
<T> ParameterExpression<T> parameter(Class<T> paramClass)
Create a parameter expression.- Parameters:
paramClass
- parameter class- Returns:
- parameter expression
-
parameter
<T> ParameterExpression<T> parameter(Class<T> paramClass, String name)
Create a parameter expression with the given name.- Parameters:
paramClass
- parameter classname
- name that can be used to refer to the parameter- Returns:
- parameter expression
-
isEmpty
<C extends Collection<?>> Predicate isEmpty(Expression<C> collection)
Create a predicate that tests whether a collection is empty.- Parameters:
collection
- expression- Returns:
- is-empty predicate
-
isNotEmpty
<C extends Collection<?>> Predicate isNotEmpty(Expression<C> collection)
Create a predicate that tests whether a collection is not empty.- Parameters:
collection
- expression- Returns:
- is-not-empty predicate
-
size
<C extends Collection<?>> Expression<Integer> size(Expression<C> collection)
Create an expression that tests the size of a collection.- Parameters:
collection
- expression- Returns:
- size expression
-
size
<C extends Collection<?>> Expression<Integer> size(C collection)
Create an expression that tests the size of a collection.- Parameters:
collection
- collection- Returns:
- size expression
-
isMember
<E,C extends Collection<E>> Predicate isMember(Expression<E> elem, 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.- Parameters:
elem
- element expressioncollection
- expression- Returns:
- is-member predicate
-
isMember
<E,C extends Collection<E>> Predicate isMember(E elem, 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.- Parameters:
elem
- elementcollection
- expression- Returns:
- is-member predicate
-
isNotMember
<E,C extends Collection<E>> Predicate isNotMember(Expression<E> elem, 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.- Parameters:
elem
- element expressioncollection
- expression- Returns:
- is-not-member predicate
-
isNotMember
<E,C extends Collection<E>> Predicate isNotMember(E elem, 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.- Parameters:
elem
- elementcollection
- expression- Returns:
- is-not-member predicate
-
values
<V,M extends Map<?,V>> Expression<Collection<V>> values(M map)
Create an expression that returns the values of a map.- Parameters:
map
- map- Returns:
- collection expression
-
keys
<K,M extends Map<K,?>> Expression<Set<K>> keys(M map)
Create an expression that returns the keys of a map.- Parameters:
map
- map- Returns:
- set expression
-
like
Predicate like(Expression<String> x, Expression<String> pattern)
Create a predicate for testing whether the expression satisfies the given pattern.- Parameters:
x
- string expressionpattern
- string expression- Returns:
- like predicate
-
like
Predicate like(Expression<String> x, String pattern)
Create a predicate for testing whether the expression satisfies the given pattern.- Parameters:
x
- string expressionpattern
- string- Returns:
- like predicate
-
like
Predicate like(Expression<String> x, Expression<String> pattern, 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
Predicate like(Expression<String> x, 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
Predicate like(Expression<String> x, String pattern, 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
Predicate like(Expression<String> x, String pattern, char escapeChar)
Create a predicate for testing whether the expression satisfies the given pattern.- Parameters:
x
- string expressionpattern
- stringescapeChar
- escape character- Returns:
- like predicate
-
notLike
Predicate notLike(Expression<String> x, Expression<String> pattern)
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
Predicate notLike(Expression<String> x, String pattern)
Create a predicate for testing whether the expression does not satisfy the given pattern.- Parameters:
x
- string expressionpattern
- string- Returns:
- not-like predicate
-
notLike
Predicate notLike(Expression<String> x, Expression<String> pattern, 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
Predicate notLike(Expression<String> x, 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
Predicate notLike(Expression<String> x, String pattern, 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
Predicate notLike(Expression<String> x, String pattern, char escapeChar)
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
Expression<String> concat(Expression<String> x, Expression<String> y)
Create an expression for string concatenation.- Parameters:
x
- string expressiony
- string expression- Returns:
- expression corresponding to concatenation
-
concat
Expression<String> concat(Expression<String> x, String y)
Create an expression for string concatenation.- Parameters:
x
- string expressiony
- string- Returns:
- expression corresponding to concatenation
-
concat
Expression<String> concat(String x, Expression<String> y)
Create an expression for string concatenation.- Parameters:
x
- stringy
- string expression- Returns:
- expression corresponding to concatenation
-
substring
Expression<String> substring(Expression<String> x, 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
Expression<String> substring(Expression<String> x, int 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- Returns:
- expression corresponding to substring extraction
-
substring
Expression<String> substring(Expression<String> x, Expression<Integer> from, 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
Expression<String> substring(Expression<String> x, int from, int 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 positionlen
- length- Returns:
- expression corresponding to substring extraction
-
trim
Expression<String> trim(Expression<String> x)
Create expression to trim blanks from both ends of a string.- Parameters:
x
- expression for string to trim- Returns:
- trim expression
-
trim
Expression<String> trim(CriteriaBuilder.Trimspec ts, Expression<String> x)
Create expression to trim blanks from a string.- Parameters:
ts
- trim specificationx
- expression for string to trim- Returns:
- trim expression
-
trim
Expression<String> trim(Expression<Character> t, Expression<String> x)
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
Expression<String> trim(CriteriaBuilder.Trimspec ts, Expression<Character> t, 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
Expression<String> trim(char t, Expression<String> x)
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
Expression<String> trim(CriteriaBuilder.Trimspec ts, char t, 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
Expression<String> lower(Expression<String> x)
Create expression for converting a string to lowercase.- Parameters:
x
- string expression- Returns:
- expression to convert to lowercase
-
upper
Expression<String> upper(Expression<String> x)
Create expression for converting a string to uppercase.- Parameters:
x
- string expression- Returns:
- expression to convert to uppercase
-
length
Expression<Integer> length(Expression<String> x)
Create expression to return length of a string.- Parameters:
x
- string expression- Returns:
- length expression
-
locate
Expression<Integer> 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. 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
Expression<Integer> locate(Expression<String> x, 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
- string to be located- Returns:
- expression corresponding to position
-
locate
Expression<Integer> 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. 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
Expression<Integer> 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. 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
Expression<Date> currentDate()
Create expression to return current date.- Returns:
- expression for current date
-
currentTimestamp
Expression<Timestamp> currentTimestamp()
Create expression to return current timestamp.- Returns:
- expression for current timestamp
-
currentTime
Expression<Time> currentTime()
Create expression to return current time.- Returns:
- expression for current time
-
localDate
Expression<LocalDate> localDate()
Create expression to return current local date.- Returns:
- expression for current date
-
localDateTime
Expression<LocalDateTime> localDateTime()
Create expression to return current local datetime.- Returns:
- expression for current timestamp
-
localTime
Expression<LocalTime> localTime()
Create expression to return current local time.- Returns:
- expression for current time
-
in
<T> CriteriaBuilder.In<T> in(Expression<? extends T> expression)
Create predicate to test whether given expression is contained in a list of values.- Parameters:
expression
- to be tested against list of values- Returns:
- in predicate
-
coalesce
<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.- Parameters:
x
- expressiony
- expression- Returns:
- coalesce expression
-
coalesce
<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.- Parameters:
x
- expressiony
- value- Returns:
- coalesce expression
-
nullif
<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.- Parameters:
x
- expressiony
- expression- Returns:
- nullif expression
-
nullif
<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.- Parameters:
x
- expressiony
- value- Returns:
- nullif expression
-
coalesce
<T> CriteriaBuilder.Coalesce<T> coalesce()
Create a coalesce expression.- Returns:
- coalesce expression
-
selectCase
<C,R> CriteriaBuilder.SimpleCase<C,R> selectCase(Expression<? extends C> expression)
Create a simple case expression.- Parameters:
expression
- to be tested against the case conditions- Returns:
- simple case expression
-
selectCase
<R> CriteriaBuilder.Case<R> selectCase()
Create a general case expression.- Returns:
- general case expression
-
function
<T> Expression<T> function(String name, Class<T> type, Expression<?>... args)
Create an expression for the execution of a database function.- Parameters:
name
- function nametype
- expected result typeargs
- function arguments- Returns:
- expression
-
treat
<X,T,V extends T> Join<X,V> treat(Join<X,T> join, Class<V> type)
Downcast Join object to the specified type.- Parameters:
join
- Join objecttype
- type to be downcast to- Returns:
- Join object of the specified type
- Since:
- 2.1
-
treat
<X,T,E extends T> CollectionJoin<X,E> treat(CollectionJoin<X,T> join, Class<E> type)
Downcast CollectionJoin object to the specified type.- Parameters:
join
- CollectionJoin objecttype
- type to be downcast to- Returns:
- CollectionJoin object of the specified type
- Since:
- 2.1
-
treat
<X,T,E extends T> SetJoin<X,E> treat(SetJoin<X,T> join, Class<E> type)
Downcast SetJoin object to the specified type.- Parameters:
join
- SetJoin objecttype
- type to be downcast to- Returns:
- SetJoin object of the specified type
- Since:
- 2.1
-
treat
<X,T,E extends T> ListJoin<X,E> treat(ListJoin<X,T> join, Class<E> type)
Downcast ListJoin object to the specified type.- Parameters:
join
- ListJoin objecttype
- type to be downcast to- Returns:
- ListJoin object of the specified type
- Since:
- 2.1
-
treat
<X,K,T,V extends T> MapJoin<X,K,V> treat(MapJoin<X,K,T> join, Class<V> type)
Downcast MapJoin object to the specified type.- Parameters:
join
- MapJoin objecttype
- type to be downcast to- Returns:
- MapJoin object of the specified type
- Since:
- 2.1
-
treat
<X,T extends X> Path<T> treat(Path<X> path, Class<T> type)
Downcast Path object to the specified type.- Parameters:
path
- pathtype
- type to be downcast to- Returns:
- Path object of the specified type
- Since:
- 2.1
-
-