hibernate/hibernate-orm · error · SemanticException
First operand for includes predicate must be a basic plural
Error message
First operand for includes predicate must be a basic plural type expression, but found: {} What it means
Error "First operand for includes predicate must be a basic plural type expression, but found: {}" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java:2581
"First operand for contains predicate must be a basic plural type expression, but found: " + lhsExpressible.getSqmType(),
query
);
}
final SelfRenderingSqmFunction<Boolean> contains = getFunctionDescriptor(
"array_contains" ).generateSqmExpression(
asList( lhs, rhs ),
null,
queryEngine()
);
yield new SqmBooleanExpressionPredicate( contains, negated, nodeBuilder() );
}
case HqlParser.INCLUDES -> {
final var lhs = (SqmExpression<?>) lhsCtx.accept( this );
final var rhs = (SqmExpression<?>) rhsCtx.accept( this );
final var lhsExpressible = lhs.getExpressible();
final var rhsExpressible = rhs.getExpressible();
if ( lhsExpressible != null && !( lhsExpressible.getSqmType() instanceof BasicPluralType<?, ?>) ) {
throw new SemanticException(
"First operand for includes predicate must be a basic plural type expression, but found: "
+ lhsExpressible.getSqmType(),
query
);
}
if ( rhsExpressible != null && !( rhsExpressible.getSqmType() instanceof BasicPluralType<?, ?>) ) {
throw new SemanticException(
"Second operand for includes predicate must be a basic plural type expression, but found: "
+ rhsExpressible.getSqmType(),
query
);
}
final SelfRenderingSqmFunction<Boolean> contains = getFunctionDescriptor( "array_includes" ).generateSqmExpression(
asList( lhs, rhs ),
null,
queryEngine()
);
yield new SqmBooleanExpressionPredicate( contains, negated, nodeBuilder() );View on GitHub (pinned to fad1729dce)
Solutions
- Use a basic plural expression as the first operand of 'includes'.
- Verify the operand is an array/collection of basic type.
When it happens
Trigger: A path expression of the wrong type is used in a collection predicate.
Common situations: Applying member of / is empty / includes / intersects / in-array to non-plural expressions.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/4a32065aa9980c74.
Report an issue: GitHub.