hibernate/hibernate-orm · error · SemanticException
Operand of 'is empty' operator must be a plural path
Error message
Operand of 'is empty' operator must be a plural path
What it means
Error "Operand of 'is empty' operator must be a plural path" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java:2530
(SqmExpression<?>) ctx.expression( 2 ).accept( this ),
ctx.NOT() != null,
nodeBuilder()
);
}
@Override
public SqmPredicate visitUnaryIsPredicate(HqlParser.UnaryIsPredicateContext ctx) {
final var expression = (SqmExpression<?>) ctx.expression().accept( this );
final var negated = ctx.NOT() != null;
final var nodeBuilder = nodeBuilder();
return switch ( ((TerminalNode) ctx.getChild( ctx.getChildCount() - 1 )).getSymbol().getType() ) {
case HqlParser.NULL -> new SqmNullnessPredicate( expression, negated, nodeBuilder );
case HqlParser.EMPTY -> {
if ( expression instanceof SqmPluralValuedSimplePath<?> pluralValuedSimplePath ) {
yield new SqmEmptinessPredicate( pluralValuedSimplePath, negated, nodeBuilder );
}
else {
throw new SemanticException( "Operand of 'is empty' operator must be a plural path", query );
}
}
case HqlParser.TRUE -> new SqmTruthnessPredicate( expression, true, negated, nodeBuilder );
case HqlParser.FALSE -> new SqmTruthnessPredicate( expression, false, negated, nodeBuilder );
default -> throw new AssertionError( "Unknown unary is predicate: " + ctx.getChild( ctx.getChildCount() - 1 ) );
};
}
@Override
public SqmPredicate visitBinaryExpressionPredicate(HqlParser.BinaryExpressionPredicateContext ctx) {
final var firstSymbol = ((TerminalNode) ctx.getChild( 1 )).getSymbol();
final boolean negated;
final Token operationSymbol;
if ( firstSymbol.getType() == HqlParser.NOT ) {
negated = true;
operationSymbol = ((TerminalNode) ctx.getChild( 2 )).getSymbol();
}
else {View on GitHub (pinned to fad1729dce)
Solutions
- Apply 'is empty' only to collection-valued paths.
- Check that the operand is a mapped collection attribute.
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/c8ffa0a038f8525a.
Report an issue: GitHub.