- Type Parameters:
T- The database entity this update applies to.
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Represents an operation on a field of a database entity. Used by the database proxy to apply changes to fields of a table row.
See the
FieldUpdate class for more info.-
Method Summary
Modifier and TypeMethodDescriptionstatic UpdateExpression<Number> abs()Creates an update expression evaluating the absolute value of the current value.static <N extends Number>
UpdateExpression<N> add(N number) Creates an update expression adding a number onto the current value of the fieldstatic UpdateExpression<String> Creates an update expression appending a string to the current value.jakarta.persistence.criteria.Expression<T> apply(jakarta.persistence.criteria.Expression<T> currentValue, jakarta.persistence.criteria.Root<?> queryRoot, jakarta.persistence.criteria.CriteriaBuilder cb) Applies an update to the value of the current field represented by a JPA expression.static <N extends Number>
UpdateExpression<Number> divide(N number) Creates an update expression dividing the field by the given number.static UpdateExpression<Double> ln()Creates an update expression evaluating the natural logarithm of the current value.static UpdateExpression<Double> Creates an update expression evaluating the current value log base n.static <N extends Number>
UpdateExpression<N> multiply(N number) Creates an update expression multiplying the field by the given number.static UpdateExpression<String> Creates an update expression prepending a string to the current value.static <N extends Number>
UpdateExpression<Double> raiseToThePowerOf(N number) Creates an update expression raising the value of a field by the power of the given number.static <V> UpdateExpression<V> setTo(V literal) Creates an update expression setting the value of a field to the given value.static UpdateExpression<Double> sqrt()Creates an update expression evaluating the square root of the current value.static UpdateExpression<String> subString(int startIndex) Creates an update expression evaluating a substring of the current value.static UpdateExpression<String> subString(int startIndex, int len) Creates an update expression evaluating a substring of the current value.static <N extends Number>
UpdateExpression<N> subtract(N number) Creates an update expression subtracting a number onto the current value of the field.static UpdateExpression<String> trim()Creates an update expression trimming the current value.static UpdateExpression<String> Creates an update expression trimming leading whitespace from the current value.static UpdateExpression<String> Creates an update expression trimming trailing whitespace from the current value.
-
Method Details
-
apply
jakarta.persistence.criteria.Expression<T> apply(jakarta.persistence.criteria.Expression<T> currentValue, jakarta.persistence.criteria.Root<?> queryRoot, jakarta.persistence.criteria.CriteriaBuilder cb) Applies an update to the value of the current field represented by a JPA expression.- Parameters:
currentValue- The JPA expression representing the current value of the field.queryRoot- The JPA query root.cb- The JPA criteria builder.- Returns:
- A JPA expression representing the updated value.
-
setTo
Creates an update expression setting the value of a field to the given value.- Type Parameters:
V- The type of the value.- Parameters:
literal- The value to set the field to.- Returns:
- The update expression.
-
add
Creates an update expression adding a number onto the current value of the field- Type Parameters:
N- The type of the number.- Parameters:
number- The number to add onto the current value.- Returns:
- The update expression.
-
subtract
Creates an update expression subtracting a number onto the current value of the field.- Type Parameters:
N- The type of the number.- Parameters:
number- The number to add onto the current value.- Returns:
- The update expression.
-
multiply
Creates an update expression multiplying the field by the given number.- Type Parameters:
N- The type of the number.- Parameters:
number- The number to multiply the current value by.- Returns:
- The update expression.
-
divide
Creates an update expression dividing the field by the given number.- Type Parameters:
N- The type of the number.- Parameters:
number- The number to divide the current value by.- Returns:
- The update expression.
-
raiseToThePowerOf
Creates an update expression raising the value of a field by the power of the given number.- Type Parameters:
N- The type of the number.- Parameters:
number- The number.- Returns:
- The update expression.
-
logBaseN
Creates an update expression evaluating the current value log base n.- Parameters:
n- The number.- Returns:
- The update expression.
-
ln
Creates an update expression evaluating the natural logarithm of the current value.- Returns:
- The update expression.
-
sqrt
Creates an update expression evaluating the square root of the current value.- Returns:
- The update expression.
-
abs
Creates an update expression evaluating the absolute value of the current value.- Returns:
- The update expression.
-
prepend
Creates an update expression prepending a string to the current value.- Parameters:
prefix- The prefix to prepend to the current value.- Returns:
- The update expression.
-
append
Creates an update expression appending a string to the current value.- Parameters:
suffix- The suffix to append to the current value.- Returns:
- The update expression.
-
trim
Creates an update expression trimming the current value.- Returns:
- The update expression.
-
trimTrailing
Creates an update expression trimming trailing whitespace from the current value.- Returns:
- The update expression.
-
trimLeading
Creates an update expression trimming leading whitespace from the current value.- Returns:
- The update expression.
-
subString
Creates an update expression evaluating a substring of the current value.- Parameters:
startIndex- The start index to substring from.- Returns:
- The update expression.
-
subString
Creates an update expression evaluating a substring of the current value.- Parameters:
startIndex- The start index to substring from.len- The end index to substring from (exclusive).- Returns:
- The update expression.
-