hibernate/hibernate-orm · error · UnsupportedOperationException

Summarization is not supported by DBMS!

Error message

Summarization is not supported by DBMS!

What it means

MaxDBSqlAstTranslator.renderPartitionItem() handles GROUP BY items that are Literals by rendering a constant expression, but a Summarization expression (ROLLUP / GROUPING SETS) cannot be rendered on MaxDB. The comment notes the only theoretical emulation is rewriting the whole query spec into grouping variations joined by UNION ALL, so the translator throws UnsupportedOperationException.

Source

Thrown at hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/MaxDBSqlAstTranslator.java:71

		// Couldn't find documentation for older versions, but 7.7 supports ANSI style case expressions
		if ( getDialect().getVersion().isBefore( 7, 7 ) ) {
			visitDecodeCaseSearchedExpression( caseSearchedExpression );
		}
		else {
			super.visitCaseSearchedExpression( caseSearchedExpression, inSelect );
		}
	}

	@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. Rewrite the report as one query per grouping level combined with UNION ALL
  2. Aggregate in the application layer instead of SQL
  3. Use a native query if your MaxDB version exposes its own grouping extensions

Example fix

// before
"select p.cat, p.supplier, sum(p.qty) from Purchase p group by rollup(p.cat, p.supplier)"

// after
"select p.cat, p.supplier, sum(p.qty) from Purchase p group by p.cat, p.supplier" +
" union all " +
"select p.cat, null, sum(p.qty) from Purchase p group by p.cat" +
" union all " +
"select null, null, sum(p.qty) from Purchase p"
Defensive patterns

Strategy: try-catch

Validate before calling

static boolean dialectSupportsSummarization(Dialect d) {
    return !(d instanceof MaxDBDialect);
}
if ( !dialectSupportsSummarization(session.getJdbcServices().getDialect())
        && hql.toLowerCase().matches("(?s).*(rollup|grouping\\s+sets)\\s*\\(.*") ) {
    // rewrite before running
}

Type guard

static boolean isMaxDB(Dialect d) { return d instanceof MaxDBDialect; }

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: Executing an HQL/criteria query with 'group by rollup(...)' or 'group by grouping sets(...)' on the MaxDB community dialect; the Summarization node reaches renderPartitionItem() while the SQL AST is rendered.

Common situations: Legacy MaxDB systems asked to run modern analytics queries; shared reporting HQL reused across heterogeneous databases; smoke tests that exercise the full @NamedQuery catalog on all profiles.

Related errors


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