{"record":{"id":"180fd0711393f850","repo":"hibernate/hibernate-orm","slug":"summarization-is-not-supported-by-dbms-180fd0","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/MimerSQLSqlAstTranslator.java","lineNumber":60,"sourceCode":"\n\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\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":42,"sourceCodeEnd":68,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/MimerSQLSqlAstTranslator.java#L42-L68","documentation":"MimerSQLSqlAstTranslator.renderPartitionItem() throws UnsupportedOperationException when a GROUP BY item is a Summarization expression (ROLLUP / GROUPING SETS). Literal group-by items are emulated with a constant expression, but summarization would require rewriting the entire query spec into grouping variations joined by UNION ALL, which the item-level hook cannot do.","triggerScenarios":"Running HQL or criteria queries with 'group by rollup(...)' or 'group by grouping sets(...)' on the Mimer SQL community dialect; the Summarization node reaches renderPartitionItem() during SQL rendering.","commonSituations":"Analytics-style @NamedQueries exercised against Mimer in tests; porting cross-database report modules; subtotal/grand-total aggregations attempted in JPQL.","solutions":["Split into per-level grouped queries combined with UNION ALL","Do the aggregation in the application after fetching detail rows","Fall back to native SQL for the aggregation-heavy report"],"exampleFix":"// before\n\"select s.store, s.region, sum(s.revenue) from Sales s group by rollup(s.store, s.region)\"\n\n// after\n\"select s.store, s.region, sum(s.revenue) from Sales s group by s.store, s.region\" +\n\" union all \" +\n\"select null, s.region, sum(s.revenue) from Sales s group by s.region\" +\n\" union all \" +\n\"select null, null, sum(s.revenue) from Sales s\"","handlingStrategy":"try-catch","validationCode":"static boolean dialectSupportsSummarization(Dialect d) {\n    return !(d instanceof MimerSQLDialect);\n}\nif ( !dialectSupportsSummarization(session.getJdbcServices().getDialect())\n        && hql.toLowerCase().matches(\"(?s).*(rollup|grouping\\\\s+sets)\\\\s*\\\\(.*\") ) {\n    // rewrite as union-all or aggregate in Java\n}","typeGuard":"static boolean isMimer(Dialect d) { return d instanceof MimerSQLDialect; }","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 rollup/grouping-sets out of queries executed on Mimer SQL","Centralize analytics queries so dialect fallbacks are implementable in one place","Run the full named-query catalog against each supported dialect in CI"],"tags":["hibernate","mimer-sql","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"}