hibernate/hibernate-orm · error · ParsingException

Unrecognized set operator: " + token.getText()

Error message

Unrecognized set operator: " + token.getText()

What it means

Error "Unrecognized set operator: " + token.getText()" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java:1123

				}
			}
			// else if QueryOrderExpressionContext, nothing to do
		}
		finally {
			processingStateStack.pop();
		}
		return queryGroup;
	}

	@Override
	public SetOperator visitSetOperator(HqlParser.SetOperatorContext ctx) {
		final var token = ( (TerminalNode) ctx.getChild( 0 ) ).getSymbol();
		final boolean all = ctx.getChildCount() == 2;
		return switch ( token.getType() ) {
			case UNION -> all ? SetOperator.UNION_ALL : SetOperator.UNION;
			case INTERSECT -> all ? SetOperator.INTERSECT_ALL : SetOperator.INTERSECT;
			case EXCEPT -> all ? SetOperator.EXCEPT_ALL : SetOperator.EXCEPT;
			default -> throw new ParsingException( "Unrecognized set operator: " + token.getText() );
		};
	}

	protected void visitLimitOffset(SqmQueryPart<?> sqmQueryPart, HqlParser.LimitOffsetContext ctx) {
		if ( ctx != null ) {
			final var limitClauseContext = ctx.limitClause();
			final var offsetClauseContext = ctx.offsetClause();
			final var fetchClauseContext = ctx.fetchClause();
			if ( limitClauseContext != null || offsetClauseContext != null || fetchClauseContext != null ) {
				if ( getCreationOptions().useStrictJpaCompliance() ) {
					throw new StrictJpaComplianceViolation(
							StrictJpaComplianceViolation.Type.LIMIT_OFFSET_CLAUSE
					);
				}

				if ( processingStateStack.depth() > 1 && sqmQueryPart.getOrderByClause() == null ) {
					throw new SemanticException(
							"A 'limit', 'offset', or 'fetch' clause requires an 'order by' clause when used in a subquery",

View on GitHub (pinned to fad1729dce)

Solutions

  1. Use union, intersect, or except as the set operator.
  2. Fix the set-operation syntax in the query.

When it happens

Trigger: A runtime precondition of the Hibernate API is violated.

Common situations: Occurs when application code or configuration does not satisfy the documented contract of the API being called.


AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22). Data as JSON: /api/errors/4312ce56227ba77c. Report an issue: GitHub.