{"record":{"id":"314cdcbad7517574","repo":"hibernate/hibernate-orm","slug":"summarization-is-not-supported-by-dbms-314cdc","errorCode":null,"errorMessage":"Summarization is not supported by DBMS","messagePattern":"Summarization is not supported by DBMS","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/SybaseASELegacySqlAstTranslator.java","lineNumber":449,"sourceCode":"\t@Override\n\tprotected void renderSelectTupleComparison(\n\t\t\tList<SqlSelection> lhsExpressions,\n\t\t\tSqlTuple tuple,\n\t\t\tComparisonOperator operator) {\n\t\temulateSelectTupleComparison( lhsExpressions, tuple.getExpressions(), operator, true );\n\t}\n\n\t@Override\n\tprotected void renderPartitionItem(Expression expression) {\n\t\tif ( expression instanceof Literal ) {\n\t\t\t// Note that this depends on the SqmToSqlAstConverter to add a dummy table group\n\t\t\tappendSql( \"dummy_.x\" );\n\t\t}\n\t\telse if ( expression instanceof Summarization ) {\n\t\t\t// This could theoretically be emulated by rendering all grouping variations of the query and\n\t\t\t// connect them via union all but that's probably pretty inefficient and would have to happen\n\t\t\t// on the query spec level\n\t\t\tthrow new UnsupportedOperationException( \"Summarization is not supported by DBMS\" );\n\t\t}\n\t\telse {\n\t\t\texpression.accept( this );\n\t\t}\n\t}\n\n\t@Override\n\tpublic void visitBinaryArithmeticExpression(BinaryArithmeticExpression arithmeticExpression) {\n\t\tappendSql( OPEN_PARENTHESIS );\n\t\tvisitArithmeticOperand( arithmeticExpression.getLeftHandOperand() );\n\t\tappendSql( arithmeticExpression.getOperator().getOperatorSqlTextString() );\n\t\tvisitArithmeticOperand( arithmeticExpression.getRightHandOperand() );\n\t\tappendSql( CLOSE_PARENTHESIS );\n\t}\n\n\t@Override\n\tprotected String determineColumnReferenceQualifier(ColumnReference columnReference) {\n\t\tfinal DmlTargetColumnQualifierSupport qualifierSupport = getDialect().getDmlTargetColumnQualifierSupport();","sourceCodeStart":431,"sourceCodeEnd":467,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/SybaseASELegacySqlAstTranslator.java#L431-L467","documentation":"renderPartitionItem() in SybaseASELegacySqlAstTranslator throws when the SQL AST contains a Summarization node, i.e. GROUP BY ROLLUP(...), CUBE(...) or GROUPING SETS(...). Sybase ASE (legacy dialect) has no grouping-sets syntax, and the source comment notes the theoretical union-all emulation is deemed too inefficient to implement, so rendering aborts with UnsupportedOperationException during query translation. It is the ASE counterpart of the same guard in the SQLite translator.","triggerScenarios":"Executing HQL like 'select year(o.date), sum(o.total) from Order o group by rollup(year(o.date))' or Criteria rollup/cube grouping against Sybase ASE via the legacy dialect; running reporting HQL written for other databases on ASE.","commonSituations":"Reporting or warehouse-style queries pointed at a legacy ASE instance; shared analytics modules enabled for an ASE deployment; BI-generated HQL migrated between databases.","solutions":["Replace rollup()/cube() with an explicit UNION ALL of each grouped query plus a grand-total row","Pre-aggregate per grouping level with plain GROUP BY queries and assemble subtotals in Java","Run such reports against a database that supports GROUPING SETS (the ASE legacy dialect never will)","As a last resort, extend SybaseASELegacySqlAstTranslator to expand summarization into union all"],"exampleFix":"// before\nselect e.cat, sum(e.amount) from Expense e group by rollup(e.cat)\n\n// after - explicit grand total row\nselect e.cat, sum(e.amount) from Expense e group by e.cat\nunion all\nselect null, sum(e.amount) from Expense","handlingStrategy":"validation","validationCode":"void assertDialectSupportsGroupingSets(Dialect dialect, String hql) {\n    String lower = hql.toLowerCase();\n    if ((lower.contains('rollup') || lower.contains('cube') || lower.contains('grouping sets'))\n            && dialect.getClass().getName().contains('SybaseASE')) {\n        throw new UnsupportedOperationException(\n            'Sybase ASE legacy dialect has no GROUPING SETS; rewrite as UNION ALL');\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Provide a UNION ALL variant of every rollup/cube report query","Run analytics queries on a GROUPING SETS-capable database","Reject rollup()/cube() at query-build time on ASE with a clear message"],"tags":["hibernate","sybase-ase","sql-translator","group-by","rollup","cube","grouping-sets"],"backgroundTag":"unsupported-grouping-sets-rollup","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}