HHH-17355 Add array_trim functions to NodeBuilder
This commit is contained in:
parent
faf6345463
commit
6d392f5e20
|
@ -679,6 +679,34 @@ public interface NodeBuilder extends HibernateCriteriaBuilder {
|
|||
*/
|
||||
<T> SqmExpression<T[]> arrayReplace(T[] array, T oldElement, T newElement);
|
||||
|
||||
/**
|
||||
* Creates array copy without the last N elements, specified by the second argument.
|
||||
*
|
||||
* @since 6.4
|
||||
*/
|
||||
<T> SqmExpression<T[]> arrayTrim(SqmExpression<T[]> arrayExpression, SqmExpression<Integer> elementCountExpression);
|
||||
|
||||
/**
|
||||
* Creates array copy without the last N elements, specified by the second argument.
|
||||
*
|
||||
* @since 6.4
|
||||
*/
|
||||
<T> SqmExpression<T[]> arrayTrim(SqmExpression<T[]> arrayExpression, Integer elementCount);
|
||||
|
||||
/**
|
||||
* Creates array copy without the last N elements, specified by the second argument.
|
||||
*
|
||||
* @since 6.4
|
||||
*/
|
||||
<T> SqmExpression<T[]> arrayTrim(T[] array, SqmExpression<Integer> elementCountExpression);
|
||||
|
||||
/**
|
||||
* Creates array copy without the last N elements, specified by the second argument.
|
||||
*
|
||||
* @since 6.4
|
||||
*/
|
||||
<T> SqmExpression<T[]> arrayTrim(T[] array, Integer elementCount);
|
||||
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Array functions for collection types
|
||||
|
||||
|
@ -1221,6 +1249,34 @@ public interface NodeBuilder extends HibernateCriteriaBuilder {
|
|||
*/
|
||||
<E, C extends Collection<? super E>> SqmExpression<C> collectionReplace(C collection, E oldElement, E newElement);
|
||||
|
||||
/**
|
||||
* Creates basic collection copy without the last N elements, specified by the second argument.
|
||||
*
|
||||
* @since 6.4
|
||||
*/
|
||||
<C extends Collection<?>> SqmExpression<C> collectionTrim(SqmExpression<C> arrayExpression, SqmExpression<Integer> elementCountExpression);
|
||||
|
||||
/**
|
||||
* Creates basic collection copy without the last N elements, specified by the second argument.
|
||||
*
|
||||
* @since 6.4
|
||||
*/
|
||||
<C extends Collection<?>> SqmExpression<C> collectionTrim(SqmExpression<C> arrayExpression, Integer elementCount);
|
||||
|
||||
/**
|
||||
* Creates basic collection copy without the last N elements, specified by the second argument.
|
||||
*
|
||||
* @since 6.4
|
||||
*/
|
||||
<C extends Collection<?>> SqmExpression<C> collectionTrim(C collection, SqmExpression<Integer> elementCountExpression);
|
||||
|
||||
/**
|
||||
* Creates basic collection copy without the last N elements, specified by the second argument.
|
||||
*
|
||||
* @since 6.4
|
||||
*/
|
||||
<C extends Collection<?>> SqmExpression<C> collectionTrim(C collection, Integer elementCount);
|
||||
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Covariant overrides
|
||||
|
||||
|
|
|
@ -4399,6 +4399,44 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext,
|
|||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> SqmExpression<T[]> arrayTrim(
|
||||
SqmExpression<T[]> arrayExpression,
|
||||
SqmExpression<Integer> elementCountExpression) {
|
||||
return getFunctionDescriptor( "array_trim" ).generateSqmExpression(
|
||||
asList( arrayExpression, elementCountExpression ),
|
||||
null,
|
||||
queryEngine
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> SqmExpression<T[]> arrayTrim(SqmExpression<T[]> arrayExpression, Integer elementCount) {
|
||||
return getFunctionDescriptor( "array_trim" ).generateSqmExpression(
|
||||
asList( arrayExpression, value( elementCount ) ),
|
||||
null,
|
||||
queryEngine
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> SqmExpression<T[]> arrayTrim(T[] array, SqmExpression<Integer> elementCountExpression) {
|
||||
return getFunctionDescriptor( "array_trim" ).generateSqmExpression(
|
||||
asList( value( array ), elementCountExpression ),
|
||||
null,
|
||||
queryEngine
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> SqmExpression<T[]> arrayTrim(T[] array, Integer elementCount) {
|
||||
return getFunctionDescriptor( "array_trim" ).generateSqmExpression(
|
||||
asList( value( array ), value( elementCount ) ),
|
||||
null,
|
||||
queryEngine
|
||||
);
|
||||
}
|
||||
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Array functions for collection types
|
||||
|
||||
|
@ -5228,4 +5266,46 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext,
|
|||
queryEngine
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <C extends Collection<?>> SqmExpression<C> collectionTrim(
|
||||
SqmExpression<C> collectionExpression,
|
||||
SqmExpression<Integer> indexExpression) {
|
||||
return getFunctionDescriptor( "array_trim" ).generateSqmExpression(
|
||||
asList( collectionExpression, indexExpression ),
|
||||
null,
|
||||
queryEngine
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <C extends Collection<?>> SqmExpression<C> collectionTrim(
|
||||
SqmExpression<C> collectionExpression,
|
||||
Integer index) {
|
||||
return getFunctionDescriptor( "array_trim" ).generateSqmExpression(
|
||||
asList( collectionExpression, value( index ) ),
|
||||
null,
|
||||
queryEngine
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <C extends Collection<?>> SqmExpression<C> collectionTrim(
|
||||
C collection,
|
||||
SqmExpression<Integer> indexExpression) {
|
||||
return getFunctionDescriptor( "array_trim" ).generateSqmExpression(
|
||||
asList( value( collection ), indexExpression ),
|
||||
null,
|
||||
queryEngine
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <C extends Collection<?>> SqmExpression<C> collectionTrim(C collection, Integer index) {
|
||||
return getFunctionDescriptor( "array_trim" ).generateSqmExpression(
|
||||
asList( value( collection ), value( index ) ),
|
||||
null,
|
||||
queryEngine
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue