{"record":{"id":"6ab8ccaf7a925647","repo":"hibernate/hibernate-orm","slug":"summarization-is-not-supported-by-dbms-6ab8cc","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/SybaseLegacySqlAstTranslator.java","lineNumber":233,"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 boolean needsRowsToSkip() {\n\t\treturn true;","sourceCodeStart":215,"sourceCodeEnd":251,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/SybaseLegacySqlAstTranslator.java#L215-L251","documentation":"ROLLUP, CUBE and GROUPING SETS arrive at the translator as a Summarization expression that renderPartitionItem must render. Sybase ASE (legacy dialect) has no native grouping-set support and Hibernate implements no UNION ALL emulation for it, so the translator throws UnsupportedOperationException instead of generating invalid SQL.","triggerScenarios":"HQL with `group by rollup(...)`, `group by cube(...)` or `group by grouping sets(...)` (or Criteria equivalents) executed with SybaseLegacyDialect.","commonSituations":"Analytical/reporting queries with subtotal rows ported to ASE; shared reporting modules that run against multiple backends including Sybase.","solutions":["Expand the grouping sets into an explicit UNION ALL of individual GROUP BY queries","Use plain GROUP BY and compute totals in application code","Run the report as native SQL","Target a database with native grouping-set support for that report"],"exampleFix":"// before\nselect e.dept, count(e) from Employee e group by rollup(e.dept)\n\n// after\nselect e.dept, count(e) from Employee e group by e.dept\nunion all\nselect null, count(e) from Employee e","handlingStrategy":"fallback","validationCode":"static boolean dialectSupportsSummarization(Dialect d) {\n    return !(d instanceof SybaseLegacyDialect); // plus Anywhere/Teradata/TimesTen\n}","typeGuard":null,"tryCatchPattern":"try {\n    return runGroupingSetsQuery(hql);\n} catch (UnsupportedOperationException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"Summarization\")) {\n        return runUnionAllEquivalent(hql);\n    }\n    throw e;\n}","preventionTips":["Avoid rollup/cube/grouping sets in shared HQL; expand them to UNION ALL from the start","Compute totals in the service layer when the backend includes ASE","Cover analytical queries with per-dialect integration tests"],"tags":["hibernate","sybase-ase","grouping-sets","rollup","cube"],"backgroundTag":"grouping-sets-not-supported","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}