hibernate/hibernate-orm · error · UnsupportedOperationException

Summarization is not supported by DBMS

Error message

Summarization is not supported by DBMS

What it means

MappedByTableGroup represents the inverse side of a mappedBy association (classic one-to-one inverse). Its resolveTableReference delegates to the underlying table group and throws UnknownTableReferenceException when the requested table expression is not reachable through the mapped-by side - i.e. the table you need belongs to the owning side (or a secondary table of it) that this inverse group does not expose.

Source

Thrown at hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/CockroachLegacySqlAstTranslator.java:186

	}

	@Override
	public void visitOffsetFetchClause(QueryPart queryPart) {
		if ( !isRowNumberingCurrentQueryPart() ) {
			renderLimitOffsetClause( queryPart );
		}
	}

	@Override
	protected void renderPartitionItem(Expression expression) {
		if ( expression instanceof Literal ) {
			appendSql( "'0' || '0'" );
		}
		else 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 );
		}
	}

	@Override
	public void visitLikePredicate(LikePredicate likePredicate) {
		// Custom implementation because CockroachDB uses backslash as default escape character
		likePredicate.getMatchExpression().accept( this );
		if ( likePredicate.isNegated() ) {
			appendSql( " not" );
		}
		if ( likePredicate.isCaseSensitive() ) {
			appendSql( " like " );
		}
		else {
			appendSql( WHITESPACE );

View on GitHub (pinned to fad1729dce)

Solutions

  1. Traverse from the owning side of the one-to-one instead of the mappedBy side for columns of the owner's tables.
  2. Restructure the mapping: make the side you query from the owner (move the FK / drop mappedBy on that direction).
  3. Join the owning entity explicitly so its tables are in a real table group.
  4. Upgrade Hibernate - mapped-by table-group resolution has had multiple fixes; report if reproducible.

Example fix

// before: resolving owner-side columns through the inverse (mappedBy) side
"select p from Profile p join p.user u order by u.lastLoginAt" // p.user is mappedBy on User

// after: query from the owner side directly
"select u from User u join u.profile p order by u.lastLoginAt"
Defensive patterns

Strategy: try-catch

Try / catch

try {
    return em.createQuery(hql, type).getResultList();
} catch ( UnknownTableReferenceException e ) {
    // owner-side table requested through mappedBy side: query from the owner instead
    return em.createQuery(invertOneToOneNavigation(hql), type).getResultList();
}

Prevention

When it happens

Trigger: Navigating a one-to-one mappedBy association and then resolving a table (owner's primary/secondary table) through the mapped-by table group: ordering or selecting owner-side columns via the inverse path, join conditions built on owner tables, inheritance on the owning entity.

Common situations: @OneToOne(mappedBy=...) mappings where queries dereference from the inverse side; refactors moving the FK; long-standing Hibernate one-to-one inverse resolution bugs reappearing after upgrades; secondary tables on the owning entity.

Related errors


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