hibernate/hibernate-orm · error · UnsupportedOperationException
Summarization is not supported by DBMS!
Error message
Summarization is not supported by DBMS!
What it means
Hibernate models ROLLUP, CUBE and GROUPING SETS groupings as a Summarization expression that renderPartitionItem must render inside GROUP BY. SQL Anywhere has no native support for these grouping constructs, and the theoretical emulation (a UNION ALL over every grouping variation) is not implemented, so the translator throws UnsupportedOperationException at render time instead of emitting invalid SQL.
Source
Thrown at hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/SybaseAnywhereSqlAstTranslator.java:200
@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( "()" );
}
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 );
}
}
View on GitHub (pinned to fad1729dce)
Solutions
- Expand rollup/cube/grouping sets manually into a UNION ALL of the individual GROUP BY variants
- Use plain GROUP BY and compute subtotals/grand totals in application code
- Run the report as native SQL with a hand-written emulation
- Target a database/dialect that natively supports grouping sets (Oracle, SQL Server, PostgreSQL, DB2)
Example fix
// before select e.dept, e.role, count(e) from Employee e group by rollup(e.dept, e.role) // after select e.dept, e.role, count(e) from Employee e group by e.dept, e.role union all select e.dept, null, count(e) from Employee e group by e.dept union all select null, null, count(e) from Employee e
Defensive patterns
Strategy: fallback
Validate before calling
// Detect grouping-set queries before running them against dialects without support
static boolean dialectSupportsSummarization(Dialect d) {
return !(d instanceof SybaseAnywhereDialect || d instanceof SybaseLegacyDialect
|| d instanceof TeradataDialect || d instanceof TimesTenDialect);
}
// if (usesGroupingSets(hql) && !dialectSupportsSummarization(dialect)) -> use the UNION ALL variant Try / catch
try {
return runRollupQuery(hql);
} catch (UnsupportedOperationException e) {
if (e.getMessage() != null && e.getMessage().contains("Summarization")) {
return runUnionAllEquivalent(hql); // pre-written UNION ALL expansion
}
throw e;
} Prevention
- Treat rollup/cube/grouping sets as non-portable HQL: centralize them in per-dialect query repositories
- Prefer computing subtotals in application code when the backend matrix includes Sybase/Teradata/TimesTen
- Add integration tests per dialect for every analytical query
When it happens
Trigger: Executing HQL with SybaseAnywhereDialect such as `group by rollup(e.dept, e.role)`, `group by cube(e.dept, e.role)`, or `group by grouping sets((e.dept),(e.role))`, or the equivalent Criteria grouping-set queries.
Common situations: Reporting or OLAP queries ported from Oracle/SQL Server/PostgreSQL where rollup/grouping sets worked fine, then executed against a SQL Anywhere backend.
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/177826b9135fd695.
Report an issue: GitHub.