hibernate/hibernate-orm · error · UnsupportedOperationException
Summarization is not supported by DBMS
Error message
Summarization is not supported by DBMS
What it means
The legacy SAP HANA SQL translator (HANALegacySqlAstTranslator) throws this UnsupportedOperationException while translating an HQL/JPQL query that uses a Summarization expression, i.e. GROUP BY ROLLUP(...) or GROUP BY GROUPING SETS(...). When renderPartitionItem() meets a Summarization node it cannot render it as a partition/group-by item and fails fast during SQM-to-SQL translation instead of emitting invalid SQL.
Source
Thrown at hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/HANALegacySqlAstTranslator.java:302
appendSql( " not like " );
rhs.accept( this );
return;
default:
// Fall through
break;
}
}
renderComparisonStandard( lhs, operator, rhs );
}
}
@Override
protected void renderPartitionItem(Expression expression) {
if ( expression instanceof Literal ) {
appendSql( "grouping sets (())" );
}
else if ( expression instanceof Summarization ) {
throw new UnsupportedOperationException( "Summarization is not supported by DBMS" );
}
else {
expression.accept( this );
}
}
@Override
protected void renderInsertIntoNoColumns(TableInsertStandard tableInsert) {
throw new MappingException(
String.format(
"The INSERT statement for table [%s] contains no column, and this is not supported by [%s]",
tableInsert.getMutatingTable().getTableId(),
getDialect()
)
);
}
@OverrideView on GitHub (pinned to fad1729dce)
Solutions
- Rewrite the query without rollup/grouping sets: materialize each grouping variation and combine them with UNION ALL (the emulation the code comment suggests)
- Switch the dialect to the maintained org.hibernate.dialect.HANADialect in hibernate-core (drop the 'Legacy' variant) if your HANA version and Hibernate version allow it
- Run the aggregation as a native query (createNativeQuery) so the dialect's SqlAstTranslator is bypassed
Example fix
// before
List<Object[]> rows = session.createQuery(
"select e.status, count(e.id) from Order e group by rollup(e.status)", Object[].class)
.getResultList();
// after - emulate rollup with UNION ALL
List<Object[]> rows = session.createQuery(
"select e.status, count(e.id) from Order e group by e.status " +
"union all " +
"select null, count(e.id) from Order e", Object[].class)
.getResultList(); Defensive patterns
Strategy: try-catch
Validate before calling
static boolean dialectSupportsSummarization(Dialect d) {
return !(d instanceof HANALegacyDialect);
}
// gate reporting queries before execution
if ( !dialectSupportsSummarization(session.getJdbcServices().getDialect())
&& hql.toLowerCase().matches("(?s).*(rollup|grouping\\s+sets)\\s*\\(.*") ) {
throw new IllegalArgumentException("rollup/grouping sets unsupported on this dialect");
} Type guard
static boolean isLegacyHana(Dialect d) { return d instanceof HANALegacyDialect; } Try / catch
try {
return session.createQuery(hql, Object[].class).getResultList();
} catch (UnsupportedOperationException e) {
if ( String.valueOf(e.getMessage()).contains("Summarization") ) {
// fall back to native SQL or a UNION ALL rewrite
return runSummarizationFallback(hql);
}
throw e;
} Prevention
- Keep rollup/grouping sets out of shared @NamedQuery catalogs unless every target dialect supports them
- Run a startup smoke test that translates all named queries against the configured dialect (SessionFactory boot validates mappings, not every query shape)
- Prefer computing grouping-set style subtotals in the service layer when multiple databases must be supported
When it happens
Trigger: Executing an HQL or criteria query on HANALegacyDialect whose group-by uses rollup or grouping sets, e.g. 'select e.status, count(e.id) from Order e group by rollup(e.status)'. The translator hits the Summarization branch of renderPartitionItem() at SQL-generation time (typically on Query creation or first execution).
Common situations: Porting reporting/aggregation queries written for PostgreSQL/Oracle/SQLServer to HANA with the legacy dialect; upgrading to Hibernate 6.x where the legacy HANA dialect moved into the hibernate-community-dialects artifact; reusing shared @NamedQuery definitions that contain rollup across multiple databases.
Related errors
- Summarization is not supported by DBMS
- Summarization is not supported by DBMS!
- Summarization is not supported by DBMS!
- Summarization is not supported by DBMS!
- Summarization is not supported by DBMS!
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/b745128d7fbdcb64.
Report an issue: GitHub.