hibernate/hibernate-orm · error · UnsupportedOperationException

Summarization is not supported by DBMS

Error message

Summarization is not supported by DBMS

What it means

renderPartitionItem() in SybaseASELegacySqlAstTranslator throws when the SQL AST contains a Summarization node, i.e. GROUP BY ROLLUP(...), CUBE(...) or GROUPING SETS(...). Sybase ASE (legacy dialect) has no grouping-sets syntax, and the source comment notes the theoretical union-all emulation is deemed too inefficient to implement, so rendering aborts with UnsupportedOperationException during query translation. It is the ASE counterpart of the same guard in the SQLite translator.

Source

Thrown at hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/SybaseASELegacySqlAstTranslator.java:449

	@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 String determineColumnReferenceQualifier(ColumnReference columnReference) {
		final DmlTargetColumnQualifierSupport qualifierSupport = getDialect().getDmlTargetColumnQualifierSupport();

View on GitHub (pinned to fad1729dce)

Solutions

  1. Replace rollup()/cube() with an explicit UNION ALL of each grouped query plus a grand-total row
  2. Pre-aggregate per grouping level with plain GROUP BY queries and assemble subtotals in Java
  3. Run such reports against a database that supports GROUPING SETS (the ASE legacy dialect never will)
  4. As a last resort, extend SybaseASELegacySqlAstTranslator to expand summarization into union all

Example fix

// before
select e.cat, sum(e.amount) from Expense e group by rollup(e.cat)

// after - explicit grand total row
select e.cat, sum(e.amount) from Expense e group by e.cat
union all
select null, sum(e.amount) from Expense
Defensive patterns

Strategy: validation

Validate before calling

void assertDialectSupportsGroupingSets(Dialect dialect, String hql) {
    String lower = hql.toLowerCase();
    if ((lower.contains('rollup') || lower.contains('cube') || lower.contains('grouping sets'))
            && dialect.getClass().getName().contains('SybaseASE')) {
        throw new UnsupportedOperationException(
            'Sybase ASE legacy dialect has no GROUPING SETS; rewrite as UNION ALL');
    }
}

Prevention

When it happens

Trigger: Executing HQL like 'select year(o.date), sum(o.total) from Order o group by rollup(year(o.date))' or Criteria rollup/cube grouping against Sybase ASE via the legacy dialect; running reporting HQL written for other databases on ASE.

Common situations: Reporting or warehouse-style queries pointed at a legacy ASE instance; shared analytics modules enabled for an ASE deployment; BI-generated HQL migrated between databases.

Related errors


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