{"record":{"id":"250b14a7f792ac37","repo":"hibernate/hibernate-orm","slug":"summarization-is-not-supported-by-dbms-250b14","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/MaxDBSqlAstTranslator.java","lineNumber":71,"sourceCode":"\t\t// Couldn't find documentation for older versions, but 7.7 supports ANSI style case expressions\n\t\tif ( getDialect().getVersion().isBefore( 7, 7 ) ) {\n\t\t\tvisitDecodeCaseSearchedExpression( caseSearchedExpression );\n\t\t}\n\t\telse {\n\t\t\tsuper.visitCaseSearchedExpression( caseSearchedExpression, inSelect );\n\t\t}\n\t}\n\n\t@Override\n\tprotected void renderPartitionItem(Expression expression) {\n\t\tif ( expression instanceof Literal ) {\n\t\t\tappendSql( \"'0' || '0'\" );\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}\n","sourceCodeStart":53,"sourceCodeEnd":79,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/MaxDBSqlAstTranslator.java#L53-L79","documentation":"MaxDBSqlAstTranslator.renderPartitionItem() handles GROUP BY items that are Literals by rendering a constant expression, but a Summarization expression (ROLLUP / GROUPING SETS) cannot be rendered on MaxDB. The comment notes the only theoretical emulation is rewriting the whole query spec into grouping variations joined by UNION ALL, so the translator throws UnsupportedOperationException.","triggerScenarios":"Executing an HQL/criteria query with 'group by rollup(...)' or 'group by grouping sets(...)' on the MaxDB community dialect; the Summarization node reaches renderPartitionItem() while the SQL AST is rendered.","commonSituations":"Legacy MaxDB systems asked to run modern analytics queries; shared reporting HQL reused across heterogeneous databases; smoke tests that exercise the full @NamedQuery catalog on all profiles.","solutions":["Rewrite the report as one query per grouping level combined with UNION ALL","Aggregate in the application layer instead of SQL","Use a native query if your MaxDB version exposes its own grouping extensions"],"exampleFix":"// before\n\"select p.cat, p.supplier, sum(p.qty) from Purchase p group by rollup(p.cat, p.supplier)\"\n\n// after\n\"select p.cat, p.supplier, sum(p.qty) from Purchase p group by p.cat, p.supplier\" +\n\" union all \" +\n\"select p.cat, null, sum(p.qty) from Purchase p group by p.cat\" +\n\" union all \" +\n\"select null, null, sum(p.qty) from Purchase p\"","handlingStrategy":"try-catch","validationCode":"static boolean dialectSupportsSummarization(Dialect d) {\n    return !(d instanceof MaxDBDialect);\n}\nif ( !dialectSupportsSummarization(session.getJdbcServices().getDialect())\n        && hql.toLowerCase().matches(\"(?s).*(rollup|grouping\\\\s+sets)\\\\s*\\\\(.*\") ) {\n    // rewrite before running\n}","typeGuard":"static boolean isMaxDB(Dialect d) { return d instanceof MaxDBDialect; }","tryCatchPattern":"try {\n    return session.createQuery(hql, Object[].class).getResultList();\n} catch (UnsupportedOperationException e) {\n    if ( String.valueOf(e.getMessage()).contains(\"Summarization\") ) {\n        return runUnionAllFallback(hql);\n    }\n    throw e;\n}","preventionTips":["Keep grouping-set analytics out of portable JPQL run against MaxDB","Verify each report query on every supported dialect during CI","Compute subtotals in the service layer for maximum portability"],"tags":["hibernate","maxdb","group-by","rollup","grouping-sets","dialect"],"backgroundTag":"dialect-unsupported-sql-feature","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}