hibernate/hibernate-orm · error · UnsupportedOperationException

Summarization is not supported by DBMS

Error message

Summarization is not supported by DBMS

What it means

ROLLUP, CUBE and GROUPING SETS arrive at the translator as a Summarization expression that renderPartitionItem must render. Sybase ASE (legacy dialect) has no native grouping-set support and Hibernate implements no UNION ALL emulation for it, so the translator throws UnsupportedOperationException instead of generating invalid SQL.

Source

Thrown at hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/SybaseLegacySqlAstTranslator.java:233

	@Override
	protected void renderSelectTupleComparison(
			List<SqlSelection> lhsExpressions,
			SqlTuple tuple,
			ComparisonOperator operator) {
		emulateSelectTupleComparison( lhsExpressions, tuple.getExpressions(), operator, true );
	}

	@Override
	protected void renderPartitionItem(Expression expression) {
		if ( expression instanceof Literal ) {
			// Note that this depends on the SqmToSqlAstConverter to add a dummy table group
			appendSql( "dummy_.x" );
		}
		else if ( expression instanceof Summarization ) {
			// This could theoretically be emulated by rendering all grouping variations of the query and
			// connect them via union all but that's probably pretty inefficient and would have to happen
			// on the query spec level
			throw new UnsupportedOperationException( "Summarization is not supported by DBMS" );
		}
		else {
			expression.accept( this );
		}
	}

	@Override
	public void visitBinaryArithmeticExpression(BinaryArithmeticExpression arithmeticExpression) {
		appendSql( OPEN_PARENTHESIS );
		visitArithmeticOperand( arithmeticExpression.getLeftHandOperand() );
		appendSql( arithmeticExpression.getOperator().getOperatorSqlTextString() );
		visitArithmeticOperand( arithmeticExpression.getRightHandOperand() );
		appendSql( CLOSE_PARENTHESIS );
	}

	@Override
	protected boolean needsRowsToSkip() {
		return true;

View on GitHub (pinned to fad1729dce)

Solutions

  1. Expand the grouping sets into an explicit UNION ALL of individual GROUP BY queries
  2. Use plain GROUP BY and compute totals in application code
  3. Run the report as native SQL
  4. Target a database with native grouping-set support for that report

Example fix

// before
select e.dept, count(e) from Employee e group by rollup(e.dept)

// after
select e.dept, count(e) from Employee e group by e.dept
union all
select null, count(e) from Employee e
Defensive patterns

Strategy: fallback

Validate before calling

static boolean dialectSupportsSummarization(Dialect d) {
    return !(d instanceof SybaseLegacyDialect); // plus Anywhere/Teradata/TimesTen
}

Try / catch

try {
    return runGroupingSetsQuery(hql);
} catch (UnsupportedOperationException e) {
    if (e.getMessage() != null && e.getMessage().contains("Summarization")) {
        return runUnionAllEquivalent(hql);
    }
    throw e;
}

Prevention

When it happens

Trigger: HQL with `group by rollup(...)`, `group by cube(...)` or `group by grouping sets(...)` (or Criteria equivalents) executed with SybaseLegacyDialect.

Common situations: Analytical/reporting queries with subtotal rows ported to ASE; shared reporting modules that run against multiple backends including Sybase.

Related errors


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