HHH-15452 Predicate add expression results in UnsupportedOperationException
This commit is contained in:
parent
0945cae46d
commit
beb7a37d02
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
package org.hibernate.query.sqm.tree.predicate;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.hibernate.query.sqm.NodeBuilder;
|
||||
|
@ -33,7 +33,7 @@ public abstract class AbstractSqmPredicate extends AbstractSqmExpression<Boolean
|
|||
@Override
|
||||
public List<Expression<Boolean>> getExpressions() {
|
||||
/// most predicates do not have sub-predicates
|
||||
return Collections.emptyList();
|
||||
return new ArrayList<>(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,14 +6,13 @@
|
|||
*/
|
||||
package org.hibernate.query.sqm.tree.predicate;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.hibernate.query.sqm.NodeBuilder;
|
||||
import org.hibernate.query.sqm.SemanticQueryWalker;
|
||||
import org.hibernate.query.sqm.tree.SqmCopyContext;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmExpression;
|
||||
import org.hibernate.sql.ast.tree.predicate.NegatedPredicate;
|
||||
|
||||
import jakarta.persistence.criteria.Expression;
|
||||
|
||||
|
@ -73,7 +72,9 @@ public class SqmBooleanExpressionPredicate extends AbstractNegatableSqmPredicate
|
|||
|
||||
@Override
|
||||
public List<Expression<Boolean>> getExpressions() {
|
||||
return Collections.singletonList( booleanExpression );
|
||||
final List<Expression<Boolean>> expressions = new ArrayList<>( 1 );
|
||||
expressions.add( booleanExpression );
|
||||
return expressions;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
package org.hibernate.query.sqm.tree.predicate;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.hibernate.query.sqm.NodeBuilder;
|
||||
|
@ -59,7 +59,9 @@ public class SqmGroupedPredicate extends AbstractSqmPredicate {
|
|||
|
||||
@Override
|
||||
public List<Expression<Boolean>> getExpressions() {
|
||||
return Collections.singletonList( subPredicate );
|
||||
final List<Expression<Boolean>> expressions = new ArrayList<>( 1 );
|
||||
expressions.add( subPredicate );
|
||||
return expressions;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -11,9 +11,7 @@ import java.util.List;
|
|||
|
||||
import org.hibernate.query.sqm.NodeBuilder;
|
||||
import org.hibernate.query.sqm.SemanticQueryWalker;
|
||||
import org.hibernate.query.sqm.SqmExpressible;
|
||||
import org.hibernate.query.sqm.tree.SqmCopyContext;
|
||||
import org.hibernate.sql.ast.tree.predicate.Junction;
|
||||
|
||||
import jakarta.persistence.criteria.Expression;
|
||||
|
||||
|
@ -88,8 +86,7 @@ public class SqmJunctionPredicate extends AbstractSqmPredicate {
|
|||
|
||||
@Override
|
||||
public List<Expression<Boolean>> getExpressions() {
|
||||
//noinspection unchecked
|
||||
return (List<Expression<Boolean>>) (List<?>) predicates;
|
||||
return new ArrayList<>( predicates );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
package org.hibernate.query.sqm.tree.predicate;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.hibernate.query.sqm.NodeBuilder;
|
||||
|
@ -58,7 +58,9 @@ public class SqmNegatedPredicate extends AbstractNegatableSqmPredicate {
|
|||
|
||||
@Override
|
||||
public List<Expression<Boolean>> getExpressions() {
|
||||
return Collections.singletonList( wrappedPredicate );
|
||||
final List<Expression<Boolean>> expressions = new ArrayList<>( 1 );
|
||||
expressions.add( wrappedPredicate );
|
||||
return expressions;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue