{"record":{"id":"a0e9f7c2f2296a1b","repo":"hibernate/hibernate-orm","slug":"summarization-is-not-supported-by-dbms-a0e9f7","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/CockroachLegacySqlAstTranslator.java","lineNumber":186,"sourceCode":"\t}\n\n\t@Override\n\tpublic void visitOffsetFetchClause(QueryPart queryPart) {\n\t\tif ( !isRowNumberingCurrentQueryPart() ) {\n\t\t\trenderLimitOffsetClause( queryPart );\n\t\t}\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\t@Override\n\tpublic void visitLikePredicate(LikePredicate likePredicate) {\n\t\t// Custom implementation because CockroachDB uses backslash as default escape character\n\t\tlikePredicate.getMatchExpression().accept( this );\n\t\tif ( likePredicate.isNegated() ) {\n\t\t\tappendSql( \" not\" );\n\t\t}\n\t\tif ( likePredicate.isCaseSensitive() ) {\n\t\t\tappendSql( \" like \" );\n\t\t}\n\t\telse {\n\t\t\tappendSql( WHITESPACE );","sourceCodeStart":168,"sourceCodeEnd":204,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/CockroachLegacySqlAstTranslator.java#L168-L204","documentation":"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.","triggerScenarios":"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.","commonSituations":"@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.","solutions":["Traverse from the owning side of the one-to-one instead of the mappedBy side for columns of the owner's tables.","Restructure the mapping: make the side you query from the owner (move the FK / drop mappedBy on that direction).","Join the owning entity explicitly so its tables are in a real table group.","Upgrade Hibernate - mapped-by table-group resolution has had multiple fixes; report if reproducible."],"exampleFix":"// before: resolving owner-side columns through the inverse (mappedBy) side\n\"select p from Profile p join p.user u order by u.lastLoginAt\" // p.user is mappedBy on User\n\n// after: query from the owner side directly\n\"select u from User u join u.profile p order by u.lastLoginAt\"","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    return em.createQuery(hql, type).getResultList();\n} catch ( UnknownTableReferenceException e ) {\n    // owner-side table requested through mappedBy side: query from the owner instead\n    return em.createQuery(invertOneToOneNavigation(hql), type).getResultList();\n}","preventionTips":["Query one-to-one relations from the owning side whenever owner-table columns are selected or ordered.","Design one-to-one mappings so the side you query most owns the FK (avoid mappedBy on the hot path).","Cover both navigation directions of every @OneToOne in integration tests."],"tags":["one-to-one","mapped-by","table-reference","mapping","sql-ast"],"backgroundTag":"unknown-table-reference","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}