HHH-15868 add truncate() to HibernateCriteriaBuilder
This commit is contained in:
parent
b2fc0c6f2d
commit
a9f34f0735
|
@ -216,6 +216,16 @@ public interface HibernateCriteriaBuilder extends CriteriaBuilder {
|
||||||
*/
|
*/
|
||||||
<T extends Number> JpaExpression<T> round(Expression<T> x, Integer n);
|
<T extends Number> JpaExpression<T> round(Expression<T> x, Integer n);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an expression that returns the first argument
|
||||||
|
* truncated to the number of decimal places given by the
|
||||||
|
* second argument.
|
||||||
|
* @param x base
|
||||||
|
* @param n number of decimal places
|
||||||
|
* @return the truncated value
|
||||||
|
*/
|
||||||
|
<T extends Number> JpaExpression<T> truncate(Expression<T> x, Integer n);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create expression to return current local date.
|
* Create expression to return current local date.
|
||||||
* @return expression for current date
|
* @return expression for current date
|
||||||
|
|
|
@ -262,6 +262,11 @@ public class HibernateCriteriaBuilderDelegate implements HibernateCriteriaBuilde
|
||||||
return criteriaBuilder.round( x, n );
|
return criteriaBuilder.round( x, n );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <T extends Number> JpaExpression<T> truncate(Expression<T> x, Integer n) {
|
||||||
|
return criteriaBuilder.truncate( x, n );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JpaExpression<LocalDate> localDate() {
|
public JpaExpression<LocalDate> localDate() {
|
||||||
return criteriaBuilder.localDate();
|
return criteriaBuilder.localDate();
|
||||||
|
|
|
@ -920,6 +920,16 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <T extends Number> JpaExpression<T> truncate(Expression<T> x, Integer n) {
|
||||||
|
return getFunctionDescriptor( "truncate" ).generateSqmExpression(
|
||||||
|
Arrays.asList( (SqmExpression<?>) x, value( n ) ),
|
||||||
|
null,
|
||||||
|
queryEngine,
|
||||||
|
getJpaMetamodel().getTypeConfiguration()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <N extends Number> SqmExpression<N> neg(Expression<N> x) {
|
public <N extends Number> SqmExpression<N> neg(Expression<N> x) {
|
||||||
final SqmExpression<N> sqmExpression = (SqmExpression<N>) x;
|
final SqmExpression<N> sqmExpression = (SqmExpression<N>) x;
|
||||||
|
|
Loading…
Reference in New Issue