{"record":{"id":"3563dba1e8f36c8b","repo":"hibernate/hibernate-orm","slug":"summarization-is-not-supported-by-dbms-3563db","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-core/src/main/java/org/hibernate/dialect/sql/ast/SybaseASESqlAstTranslator.java","lineNumber":545,"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":527,"sourceCodeEnd":563,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/dialect/sql/ast/SybaseASESqlAstTranslator.java#L527-L563","documentation":"Sybase ASE lacks grouping sets / rollup / cube. SybaseASESqlAstTranslator.renderPartitionItem throws UnsupportedOperationException('Summarization is not supported by DBMS') when a Summarization expression must be rendered for GROUP BY or window PARTITION BY items. The in-code comment explains the theoretical union-all-over-all-grouping-variations emulation is considered too inefficient and unimplemented; the literal-item branch above it (dummy_.x) shows how other special items are emulated, underscoring that summarization simply is not.","triggerScenarios":"HQL 'group by rollup(a,b)', 'group by cube(...)', 'group by grouping sets(...)' or window 'over (partition by rollup(...))' executed with SybaseASEDialect; throws during SQL rendering before execution.","commonSituations":"Porting reporting HQL from SQL Server/PostgreSQL to a legacy Sybase ASE system; running cross-dialect report tests against the ASE profile.","solutions":["Issue one plain GROUP BY query per grouping level and union the results in application code","Compute subtotals with separate aggregate queries and assemble in Java","Keep grouping-sets reporting on a warehouse/DB that supports it rather than ASE","Use native ASE SQL with manually expanded UNION ALL branches when the report must stay in the database"],"exampleFix":"// before (throws on Sybase ASE)\n\"select branch, quarter, sum(rev) from Sales s group by rollup (s.branch, s.quarter)\"\n\n// after: two queries, merged client-side\nbyBoth = em.createQuery(\"select branch, quarter, sum(rev) ... group by branch, quarter\");\nbyBranch = em.createQuery(\"select branch, sum(rev) ... group by branch\");","handlingStrategy":"validation","validationCode":"static boolean supportsSummarization(Dialect dialect) {\n    return !(dialect instanceof SybaseASEDialect || dialect instanceof SQLAnywhereDialect\n        || dialect instanceof HSQLDialect || dialect instanceof SpannerDialect);\n}\n\nif (!supportsSummarization(dialect)) {\n    return perLevelGrouping(query); // plain GROUP BY per level, merged in Java\n}","typeGuard":null,"tryCatchPattern":"try {\n    return em.createQuery(rollupHql, Object[].class).getResultList();\n} catch (UnsupportedOperationException e) {\n    if (\"Summarization is not supported by DBMS\".equals(e.getMessage())) {\n        return perLevelGrouping(query);\n    }\n    throw e;\n}","preventionTips":["Don't put rollup/cube/grouping sets into shared HQL when ASE must run it","Provide an expanded (per-level queries) report implementation and select it by dialect capability","Track which queries are reporting-only and route them to a DB that supports grouping sets"],"tags":["hibernate","sybase-ase","hql","group-by","rollup","grouping-sets"],"backgroundTag":"grouping-sets-not-supported","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}