hibernate/hibernate-orm · error · SemanticException

First operand for intersects predicate must be a basic plura

Error message

First operand for intersects predicate must be a basic plural type expression, but found: {}

What it means

Error "First operand for intersects 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:2606

					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() );
			}
			case HqlParser.INTERSECTS -> {
				final var lhs = (SqmExpression<?>) lhsCtx.accept( this );
				final var rhs = (SqmExpression<?>) rhsCtx.accept( this );
				final var lhsExpressible = lhs.getExpressible();
				if ( lhsExpressible != null && !( lhsExpressible.getSqmType() instanceof BasicPluralType<?, ?>) ) {
					throw new SemanticException(
							"First operand for intersects predicate must be a basic plural type expression, but found: "
							+ lhsExpressible.getSqmType(),
							query
					);
				}
				final SelfRenderingSqmFunction<Boolean> contains =
						getFunctionDescriptor( "array_intersects" )
								.generateSqmExpression(
										asList( lhs, rhs ),
										null,
										queryEngine()
								);
				yield new SqmBooleanExpressionPredicate( contains, negated, nodeBuilder() );
			}
			case HqlParser.EQUAL ->
					createComparisonPredicate( ComparisonOperator.EQUAL, lhsCtx, rhsCtx );
			case HqlParser.NOT_EQUAL ->
					createComparisonPredicate( ComparisonOperator.NOT_EQUAL, lhsCtx, rhsCtx );

View on GitHub (pinned to fad1729dce)

Solutions

  1. Use a basic plural expression as the first operand of 'intersects'.
  2. 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/f324f7d7f937fab5. Report an issue: GitHub.