{"record":{"id":"006a4bc7f7c0a13d","repo":"hibernate/hibernate-orm","slug":"summarization-is-not-supported-by-dbms-006a4b","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/SQLiteSqlAstTranslator.java","lineNumber":123,"sourceCode":"\t\t\t\t\ttrue,\n\t\t\t\t\t( (Every) rhs ).getSubquery(),\n\t\t\t\t\tlhs,\n\t\t\t\t\tthis::renderSelectSimpleComparison,\n\t\t\t\t\toperator.negated()\n\t\t\t);\n\t\t}\n\t\telse {\n\t\t\trenderComparisonDistinctOperator( lhs, operator, rhs );\n\t\t}\n\t}\n\n\t@Override\n\tprotected void renderPartitionItem(Expression expression) {\n\t\tif ( 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","sourceCodeStart":105,"sourceCodeEnd":130,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/SQLiteSqlAstTranslator.java#L105-L130","documentation":"renderPartitionItem() in SQLiteSqlAstTranslator throws when the SQL AST contains a Summarization node, i.e. a GROUP BY ROLLUP(...), CUBE(...) or GROUPING SETS(...) item (HQL gained rollup()/cube() grouping in Hibernate 6.6). SQLite has no grouping-sets syntax, and as the source comment notes the theoretical union-all emulation is considered too inefficient to attempt, so rendering aborts with UnsupportedOperationException during query translation.","triggerScenarios":"Executing HQL like 'select year(o.date), sum(o.total) from Order o group by rollup(year(o.date))' or the equivalent Criteria grouping on a SQLite database; reusing reporting/dashboard HQL written for PostgreSQL or Oracle against the SQLite test profile.","commonSituations":"A reporting query works on the production database (PostgreSQL/Oracle) but the test suite uses in-memory SQLite; an analytics module is enabled against an embedded SQLite store; BI-style queries are migrated from another database.","solutions":["Replace rollup()/cube() with an explicit UNION ALL of each grouped query plus a grand-total row","Pre-aggregate per grouping level in simple GROUP BY queries and compute subtotals in Java","Run such reporting queries against a database that supports GROUPING SETS (PostgreSQL, Oracle, SQL Server)","As a last resort, extend SQLiteSqlAstTranslator in a custom dialect to expand summarization into union all"],"exampleFix":"// before\nselect e.cat, sum(e.amount) from Expense e group by rollup(e.cat)\n\n// after - explicit grand total row\nselect e.cat, sum(e.amount) from Expense e group by e.cat\nunion all\nselect null, sum(e.amount) from Expense","handlingStrategy":"validation","validationCode":"void assertDialectSupportsGroupingSets(Dialect dialect, String hql) {\n    String lower = hql.toLowerCase();\n    if ((lower.contains('rollup') || lower.contains('cube') || lower.contains('grouping sets'))\n            && dialect instanceof SQLiteDialect) {\n        throw new UnsupportedOperationException(\n            'This reporting query needs GROUPING SETS support; run it on a capable database'\n            + ' or rewrite it as UNION ALL');\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep reporting HQL in database-specific query sets; give SQLite a UNION ALL variant","Integration-test analytics queries on the same engine used in production","Reject rollup()/cube() early with a clear message instead of failing at render time"],"tags":["hibernate","sqlite","sql-translator","group-by","rollup","cube","grouping-sets"],"backgroundTag":"unsupported-grouping-sets-rollup","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}