hibernate/hibernate-orm · error · UnsupportedOperationException

Summarization is not supported by DBMS

Error message

Summarization is not supported by DBMS

What it means

Sybase ASE lacks grouping sets / rollup / cube. SybaseASESqlAstTranslator.renderPartitionItem throws UnsupportedOperationException('Summarization is not supported by DBMS') when a Summarization expression must be rendered for GROUP BY or window PARTITION BY items. The in-code comment explains the theoretical union-all-over-all-grouping-variations emulation is considered too inefficient and unimplemented; the literal-item branch above it (dummy_.x) shows how other special items are emulated, underscoring that summarization simply is not.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/dialect/sql/ast/SybaseASESqlAstTranslator.java:545

	@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. Issue one plain GROUP BY query per grouping level and union the results in application code
  2. Compute subtotals with separate aggregate queries and assemble in Java
  3. Keep grouping-sets reporting on a warehouse/DB that supports it rather than ASE
  4. Use native ASE SQL with manually expanded UNION ALL branches when the report must stay in the database

Example fix

// before (throws on Sybase ASE)
"select branch, quarter, sum(rev) from Sales s group by rollup (s.branch, s.quarter)"

// after: two queries, merged client-side
byBoth = em.createQuery("select branch, quarter, sum(rev) ... group by branch, quarter");
byBranch = em.createQuery("select branch, sum(rev) ... group by branch");
Defensive patterns

Strategy: validation

Validate before calling

static boolean supportsSummarization(Dialect dialect) {
    return !(dialect instanceof SybaseASEDialect || dialect instanceof SQLAnywhereDialect
        || dialect instanceof HSQLDialect || dialect instanceof SpannerDialect);
}

if (!supportsSummarization(dialect)) {
    return perLevelGrouping(query); // plain GROUP BY per level, merged in Java
}

Try / catch

try {
    return em.createQuery(rollupHql, Object[].class).getResultList();
} catch (UnsupportedOperationException e) {
    if ("Summarization is not supported by DBMS".equals(e.getMessage())) {
        return perLevelGrouping(query);
    }
    throw e;
}

Prevention

When it happens

Trigger: HQL 'group by rollup(a,b)', 'group by cube(...)', 'group by grouping sets(...)' or window 'over (partition by rollup(...))' executed with SybaseASEDialect; throws during SQL rendering before execution.

Common situations: Porting reporting HQL from SQL Server/PostgreSQL to a legacy Sybase ASE system; running cross-dialect report tests against the ASE profile.

Related errors


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