reset the ValueHandlingMode after pagination

This commit is contained in:
Gavin King 2024-09-09 23:37:58 +02:00
parent da0b01f1e8
commit 63dde7dc09
3 changed files with 14 additions and 4 deletions

View File

@ -17,6 +17,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.hibernate.Internal;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.metamodel.model.domain.JpaMetamodel;
import org.hibernate.query.NullPrecedence;
@ -86,7 +87,8 @@ public interface NodeBuilder extends HibernateCriteriaBuilder {
QueryEngine getQueryEngine();
void setCriteriaValueHandlingMode(ValueHandlingMode criteriaValueHandlingMode);
@Internal
ValueHandlingMode setCriteriaValueHandlingMode(ValueHandlingMode criteriaValueHandlingMode);
<R> SqmTuple<R> tuple(
Class<R> tupleType,

View File

@ -166,9 +166,14 @@ abstract class AbstractSqmSelectionQuery<R> extends AbstractSelectionQuery<R> {
getSqmSelectStatement().copy( noParamCopyContext() );
final NodeBuilder builder = sqm.nodeBuilder();
//TODO: find a better way handle parameters
builder.setCriteriaValueHandlingMode(ValueHandlingMode.INLINE);
final ValueHandlingMode valueHandlingMode = builder.setCriteriaValueHandlingMode(ValueHandlingMode.INLINE);
try {
return paginate( keyDefinition, keyValues, sqm, builder );
}
finally {
builder.setCriteriaValueHandlingMode( valueHandlingMode );
}
}
@Override

View File

@ -228,8 +228,11 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext,
}
}
public void setCriteriaValueHandlingMode(ValueHandlingMode criteriaValueHandlingMode) {
@Override
public ValueHandlingMode setCriteriaValueHandlingMode(ValueHandlingMode criteriaValueHandlingMode) {
ValueHandlingMode current = this.criteriaValueHandlingMode;
this.criteriaValueHandlingMode = criteriaValueHandlingMode;
return current;
}
@Override