hibernate/hibernate-orm · error · UnsupportedOperationException

Summarization is not supported by DBMS!

Error message

Summarization is not supported by DBMS!

What it means

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.

Source

Thrown at hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/SQLiteSqlAstTranslator.java:123

					true,
					( (Every) rhs ).getSubquery(),
					lhs,
					this::renderSelectSimpleComparison,
					operator.negated()
			);
		}
		else {
			renderComparisonDistinctOperator( lhs, operator, rhs );
		}
	}

	@Override
	protected void renderPartitionItem(Expression expression) {
		if ( expression instanceof Summarization ) {
			// This could theoretically be emulated by rendering all grouping variations of the query and
			// connect them via union all but that's probably pretty inefficient and would have to happen
			// on the query spec level
			throw new UnsupportedOperationException( "Summarization is not supported by DBMS!" );
		}
		else {
			expression.accept( this );
		}
	}
}

View on GitHub (pinned to fad1729dce)

Solutions

  1. Replace rollup()/cube() with an explicit UNION ALL of each grouped query plus a grand-total row
  2. Pre-aggregate per grouping level in simple GROUP BY queries and compute subtotals in Java
  3. Run such reporting queries against a database that supports GROUPING SETS (PostgreSQL, Oracle, SQL Server)
  4. As a last resort, extend SQLiteSqlAstTranslator in a custom dialect to expand summarization into union all

Example fix

// before
select e.cat, sum(e.amount) from Expense e group by rollup(e.cat)

// after - explicit grand total row
select e.cat, sum(e.amount) from Expense e group by e.cat
union all
select null, sum(e.amount) from Expense
Defensive patterns

Strategy: validation

Validate before calling

void assertDialectSupportsGroupingSets(Dialect dialect, String hql) {
    String lower = hql.toLowerCase();
    if ((lower.contains('rollup') || lower.contains('cube') || lower.contains('grouping sets'))
            && dialect instanceof SQLiteDialect) {
        throw new UnsupportedOperationException(
            'This reporting query needs GROUPING SETS support; run it on a capable database'
            + ' or rewrite it as UNION ALL');
    }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22). Data as JSON: /api/errors/006a4bc7f7c0a13d. Report an issue: GitHub.