{"record":{"id":"2e09ab31ba6b8b36","repo":"hibernate/hibernate-orm","slug":"summarization-is-not-supported-by-dbms-2e09ab","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/RDMSOS2200SqlAstTranslator.java","lineNumber":99,"sourceCode":"\t\t\tComparisonOperator operator) {\n\t\temulateSelectTupleComparison( lhsExpressions, tuple.getExpressions(), operator, true );\n\t}\n\n\t@Override\n\tprotected void visitCaseSearchedExpression(CaseSearchedExpression caseSearchedExpression, boolean inSelect) {\n\t\tvisitDecodeCaseSearchedExpression( caseSearchedExpression );\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":81,"sourceCodeEnd":107,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/RDMSOS2200SqlAstTranslator.java#L81-L107","documentation":"RDMSOS2200 has no rollup/cube/grouping-sets support at any version; renderPartitionItem() throws UnsupportedOperationException whenever a Summarization appears among the GROUP BY items. The source comment notes the only theoretical emulation is a union-all of all grouping variations, which the translator deliberately does not attempt.","triggerScenarios":"Any HQL 'group by rollup(...)' / 'cube(...)' / 'grouping sets(...)' query translated through RDMSOS2200SqlAstTranslator.","commonSituations":"Shared report HQL run against multiple databases including a legacy Unisys RDMS/OS2200 instance; analytics features enabled globally in a product that must also support this dialect.","solutions":["Emulate rollup/cube with union all of the grouped variants","Compute subtotal and total rows in the application or reporting layer","Route that particular report to a database that supports grouping sets"],"exampleFix":"-- before (HQL)\nselect e.dept, sum(e.amount) from Expense e group by rollup(e.dept)\n\n-- after: emulate\nselect e.dept, sum(e.amount) from Expense e group by e.dept\nunion all\nselect null, sum(e.amount) from Expense e","handlingStrategy":"fallback","validationCode":"boolean supportsSummarization = false; // RDMSOS2200: never\nif ( queryUsesRollupOrCube( hql ) && !supportsSummarization ) {\n    hql = buildUnionAllEmulation( hql ); // subtotal rows via union all\n}","typeGuard":null,"tryCatchPattern":"try {\n    return em.createQuery( hql ).getResultList();\n}\ncatch ( UnsupportedOperationException e ) {\n    if ( e.getMessage() != null && e.getMessage().contains( \"Summarization\" ) ) {\n        return em.createQuery( unionAllEmulationHql ).getResultList();\n    }\n    throw e;\n}","preventionTips":["Do not use rollup/cube/grouping sets HQL against RDMSOS2200","Build subtotal logic in the application or reporting layer for this dialect","Feature-detect grouping-sets support per dialect in shared query code"],"tags":["rdms-os2200","group-by","rollup","grouping-sets"],"backgroundTag":"grouping-sets-unsupported","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}