{"record":{"id":"f324f7d7f937fab5","repo":"hibernate/hibernate-orm","slug":"first-operand-for-intersects-predicate-must-be-a-b","errorCode":null,"errorMessage":"First operand for intersects predicate must be a basic plural type expression, but found: {}","messagePattern":"First operand for intersects predicate must be a basic plural type expression, but found: (.+?)","errorType":"exception","errorClass":"SemanticException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java","lineNumber":2606,"sourceCode":"\t\t\t\t\tthrow new SemanticException(\n\t\t\t\t\t\t\t\"Second operand for includes predicate must be a basic plural type expression, but found: \"\n\t\t\t\t\t\t\t+ rhsExpressible.getSqmType(),\n\t\t\t\t\t\t\tquery\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tfinal SelfRenderingSqmFunction<Boolean> contains = getFunctionDescriptor( \"array_includes\" ).generateSqmExpression(\n\t\t\t\t\t\tasList( lhs, rhs ),\n\t\t\t\t\t\tnull,\n\t\t\t\t\t\tqueryEngine()\n\t\t\t\t);\n\t\t\t\tyield new SqmBooleanExpressionPredicate( contains, negated, nodeBuilder() );\n\t\t\t}\n\t\t\tcase HqlParser.INTERSECTS -> {\n\t\t\t\tfinal var lhs = (SqmExpression<?>) lhsCtx.accept( this );\n\t\t\t\tfinal var rhs = (SqmExpression<?>) rhsCtx.accept( this );\n\t\t\t\tfinal var lhsExpressible = lhs.getExpressible();\n\t\t\t\tif ( lhsExpressible != null && !( lhsExpressible.getSqmType() instanceof BasicPluralType<?, ?>) ) {\n\t\t\t\t\tthrow new SemanticException(\n\t\t\t\t\t\t\t\"First operand for intersects predicate must be a basic plural type expression, but found: \"\n\t\t\t\t\t\t\t+ lhsExpressible.getSqmType(),\n\t\t\t\t\t\t\tquery\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tfinal SelfRenderingSqmFunction<Boolean> contains =\n\t\t\t\t\t\tgetFunctionDescriptor( \"array_intersects\" )\n\t\t\t\t\t\t\t\t.generateSqmExpression(\n\t\t\t\t\t\t\t\t\t\tasList( lhs, rhs ),\n\t\t\t\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t\t\t\tqueryEngine()\n\t\t\t\t\t\t\t\t);\n\t\t\t\tyield new SqmBooleanExpressionPredicate( contains, negated, nodeBuilder() );\n\t\t\t}\n\t\t\tcase HqlParser.EQUAL ->\n\t\t\t\t\tcreateComparisonPredicate( ComparisonOperator.EQUAL, lhsCtx, rhsCtx );\n\t\t\tcase HqlParser.NOT_EQUAL ->\n\t\t\t\t\tcreateComparisonPredicate( ComparisonOperator.NOT_EQUAL, lhsCtx, rhsCtx );","sourceCodeStart":2588,"sourceCodeEnd":2624,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java#L2588-L2624","documentation":"Error \"First operand for intersects predicate must be a basic plural type expression, but found: {}\" thrown in hibernate/hibernate-orm.","triggerScenarios":"A path expression of the wrong type is used in a collection predicate.","commonSituations":"Applying member of / is empty / includes / intersects / in-array to non-plural expressions.","solutions":["Use a basic plural expression as the first operand of 'intersects'.","Verify the operand is an array/collection of basic type."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}