hibernate/hibernate-orm · error · UnsupportedOperationException

Unsupported frame kind:

Error message

Unsupported frame kind: 

What it means

While rendering the frame of a window function (rows/range between ...), the translator switches over FrameKind to emit SQL text for each frame boundary. Any FrameKind value not covered by the cases (the default branch) throws this UnsupportedOperationException, meaning the requested window frame boundary kind cannot be rendered by this translator/dialect path.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/sql/ast/spi/AbstractSqlAstTranslator.java:5601

			case CURRENT_ROW:
				append( "current row" );
				break;
			case UNBOUNDED_PRECEDING:
				append( "unbounded preceding" );
				break;
			case UNBOUNDED_FOLLOWING:
				append( "unbounded following" );
				break;
			case OFFSET_PRECEDING:
				expression.accept( this );
				append( " preceding" );
				break;
			case OFFSET_FOLLOWING:
				expression.accept( this );
				append( " following" );
				break;
			default:
				throw new UnsupportedOperationException( "Unsupported frame kind: " + kind );
		}
	}

	protected void renderRowNumber(SelectClause selectClause, QueryPart queryPart) {
		if ( selectClause.isDistinct() ) {
			appendSql( "dense_rank()" );
		}
		else {
			appendSql( "row_number()" );
		}
		visitOverClause( emptyList(), getSortSpecificationsRowNumbering( selectClause, queryPart ) );
	}

	public static boolean isParameter(Expression expression) {
		return expression instanceof JdbcParameter
			|| expression instanceof SqmParameterInterpretation;
	}

View on GitHub (pinned to fad1729dce)

Solutions

  1. Simplify the window frame to the common kinds (unbounded preceding/current row/offset preceding/following/unbounded following)
  2. Drop the explicit frame and rely on the function's default frame, or express the computation as a native query
  3. Check the dialect's SqlAstTranslator for supported frame kinds and align the query to them
  4. Upgrade Hibernate - window frame rendering coverage grows by version; report the unsupported kind to HHH if all standard kinds should work

Example fix

// before
// HQL: sum(x) over(order by y rows between 1 preceding and 1 following) with an unsupported kind for the dialect

// after
// HQL: sum(x) over(order by y rows between unbounded preceding and current row)
Defensive patterns

Strategy: fallback

Validate before calling

// Limit window frames to the universally rendered kinds
Set<FrameKind> safe = Set.of(FrameKind.UNBOUNDED_PRECEDING, FrameKind.PRECEDING,
        FrameKind.CURRENT_ROW, FrameKind.FOLLOWING, FrameKind.UNBOUNDED_FOLLOWING);
if (!safe.contains(frame.getKind())) { /* use default frame or native SQL */ }

Try / catch

try {
    query.list();
} catch (UnsupportedOperationException e) {
    if (String.valueOf(e.getMessage()).startsWith("Unsupported frame kind")) {
        // retry with the window function's default frame or native query
    } else throw e;
}

Prevention

When it happens

Trigger: An HQL/Criteria window function with an explicit frame specification whose frame kind is not handled in the dialect's frame rendering path - e.g. a frame end/exclusion combination the generic translator does not render, or a dialect-specific translator override that supports fewer FrameKinds than the model produced.

Common situations: Using Hibernate 6.4+ HQL window functions with frame clauses on dialects with partial support; Criteria FunctionFramework window definitions with FrameKind combinations such as GROUPS-mode boundaries; upgrading Hibernate where new FrameKinds were added but a dialect translator was not updated.

Related errors


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