hibernate/hibernate-orm · error · UnsupportedOperationException

Summarization is not supported by DBMS!

Error message

Summarization is not supported by DBMS!

What it means

MimerSQLSqlAstTranslator.renderPartitionItem() throws UnsupportedOperationException when a GROUP BY item is a Summarization expression (ROLLUP / GROUPING SETS). Literal group-by items are emulated with a constant expression, but summarization would require rewriting the entire query spec into grouping variations joined by UNION ALL, which the item-level hook cannot do.

Source

Thrown at hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/MimerSQLSqlAstTranslator.java:60

	@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 ) {
			appendSql( "'0' || '0'" );
		}
		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 );
		}
	}

}

View on GitHub (pinned to fad1729dce)

Solutions

  1. Split into per-level grouped queries combined with UNION ALL
  2. Do the aggregation in the application after fetching detail rows
  3. Fall back to native SQL for the aggregation-heavy report

Example fix

// before
"select s.store, s.region, sum(s.revenue) from Sales s group by rollup(s.store, s.region)"

// after
"select s.store, s.region, sum(s.revenue) from Sales s group by s.store, s.region" +
" union all " +
"select null, s.region, sum(s.revenue) from Sales s group by s.region" +
" union all " +
"select null, null, sum(s.revenue) from Sales s"
Defensive patterns

Strategy: try-catch

Validate before calling

static boolean dialectSupportsSummarization(Dialect d) {
    return !(d instanceof MimerSQLDialect);
}
if ( !dialectSupportsSummarization(session.getJdbcServices().getDialect())
        && hql.toLowerCase().matches("(?s).*(rollup|grouping\\s+sets)\\s*\\(.*") ) {
    // rewrite as union-all or aggregate in Java
}

Type guard

static boolean isMimer(Dialect d) { return d instanceof MimerSQLDialect; }

Try / catch

try {
    return session.createQuery(hql, Object[].class).getResultList();
} catch (UnsupportedOperationException e) {
    if ( String.valueOf(e.getMessage()).contains("Summarization") ) {
        return runUnionAllFallback(hql);
    }
    throw e;
}

Prevention

When it happens

Trigger: Running HQL or criteria queries with 'group by rollup(...)' or 'group by grouping sets(...)' on the Mimer SQL community dialect; the Summarization node reaches renderPartitionItem() during SQL rendering.

Common situations: Analytics-style @NamedQueries exercised against Mimer in tests; porting cross-database report modules; subtotal/grand-total aggregations attempted in JPQL.

Related errors


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