{"record":{"id":"4312ce56227ba77c","repo":"hibernate/hibernate-orm","slug":"unrecognized-set-operator-token-gettext","errorCode":null,"errorMessage":"Unrecognized set operator: \" + token.getText()","messagePattern":"Unrecognized set operator: \" \\+ token\\.getText\\(\\)","errorType":"exception","errorClass":"ParsingException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java","lineNumber":1123,"sourceCode":"\t\t\t\t}\n\t\t\t}\n\t\t\t// else if QueryOrderExpressionContext, nothing to do\n\t\t}\n\t\tfinally {\n\t\t\tprocessingStateStack.pop();\n\t\t}\n\t\treturn queryGroup;\n\t}\n\n\t@Override\n\tpublic SetOperator visitSetOperator(HqlParser.SetOperatorContext ctx) {\n\t\tfinal var token = ( (TerminalNode) ctx.getChild( 0 ) ).getSymbol();\n\t\tfinal boolean all = ctx.getChildCount() == 2;\n\t\treturn switch ( token.getType() ) {\n\t\t\tcase UNION -> all ? SetOperator.UNION_ALL : SetOperator.UNION;\n\t\t\tcase INTERSECT -> all ? SetOperator.INTERSECT_ALL : SetOperator.INTERSECT;\n\t\t\tcase EXCEPT -> all ? SetOperator.EXCEPT_ALL : SetOperator.EXCEPT;\n\t\t\tdefault -> throw new ParsingException( \"Unrecognized set operator: \" + token.getText() );\n\t\t};\n\t}\n\n\tprotected void visitLimitOffset(SqmQueryPart<?> sqmQueryPart, HqlParser.LimitOffsetContext ctx) {\n\t\tif ( ctx != null ) {\n\t\t\tfinal var limitClauseContext = ctx.limitClause();\n\t\t\tfinal var offsetClauseContext = ctx.offsetClause();\n\t\t\tfinal var fetchClauseContext = ctx.fetchClause();\n\t\t\tif ( limitClauseContext != null || offsetClauseContext != null || fetchClauseContext != null ) {\n\t\t\t\tif ( getCreationOptions().useStrictJpaCompliance() ) {\n\t\t\t\t\tthrow new StrictJpaComplianceViolation(\n\t\t\t\t\t\t\tStrictJpaComplianceViolation.Type.LIMIT_OFFSET_CLAUSE\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tif ( processingStateStack.depth() > 1 && sqmQueryPart.getOrderByClause() == null ) {\n\t\t\t\t\tthrow new SemanticException(\n\t\t\t\t\t\t\t\"A 'limit', 'offset', or 'fetch' clause requires an 'order by' clause when used in a subquery\",","sourceCodeStart":1105,"sourceCodeEnd":1141,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java#L1105-L1141","documentation":"Error \"Unrecognized set operator: \" + token.getText()\" thrown in hibernate/hibernate-orm.","triggerScenarios":"A runtime precondition of the Hibernate API is violated.","commonSituations":"Occurs when application code or configuration does not satisfy the documented contract of the API being called.","solutions":["Use union, intersect, or except as the set operator.","Fix the set-operation syntax in the query."],"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"}