{"record":{"id":"09ebfce27ff27083","repo":"hibernate/hibernate-orm","slug":"summarization-is-not-supported-by-dbms","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/AltibaseSqlAstTranslator.java","lineNumber":261,"sourceCode":"\t\t\t}\n\t\t\telse if ( followOnStrategy == Locking.FollowOn.IGNORE ) {\n\t\t\t\treturn LockStrategy.NONE;\n\t\t\t}\n\t\t\treturn LockStrategy.FOLLOW_ON;\n\t\t}\n\t\treturn lockStrategy;\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\tprotected void renderOffsetExpression(Expression offsetExpression) {\n\t\t// Altibase offset starts from 1\n\t\tappendSql( \"1+\" );\n\t\toffsetExpression.accept( this );\n\t}\n\n\t@Override\n\tpublic void visitValuesTableReference(ValuesTableReference tableReference) {\n\t\t// Emulated VALUES sources render through a SELECT-list, where Altibase does not reliably\n\t\t// handle plain parameter markers. Mark this context so supported values can be inlined.\n\t\tfinal boolean previousRenderingInsertSelectSource = renderingInsertSelectSource;","sourceCodeStart":243,"sourceCodeEnd":279,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/AltibaseSqlAstTranslator.java#L243-L279","documentation":"When a TableGroupJoin is inserted at a specific position, AbstractTableGroup scans existing (nested) joins for the given NavigablePath - by reference equality (==) - and throws NoSuchElementException when no existing join has that path. The from-clause graph expects the anchor path to be present before a relative insertion is requested; failing this is an internal ordering violation of SQL-AST construction, not a user-authored query error.","triggerScenarios":"Registering a join positioned relative to a navigable path that is not (yet) among the group's nestedTableGroupJoins/tableGroupJoins; passing an equal-but-distinct NavigablePath instance (reference comparison misses it); custom table group implementations or framework regressions that add joins out of order.","commonSituations":"Custom entity persister or table-group providers; SQL-AST rewriting layers (filters, tenant-id injectors, security rewriters) adding joins after translation started; rare regressions after Hibernate upgrades reordering join creation.","solutions":["Ensure the join for the anchor navigable path is added to the group before requesting a positioned insertion relative to it.","Reuse the exact NavigablePath instance already present in the group - the lookup is reference-based, so a freshly constructed equal path will not match.","Prefer addTableGroupJoin/addNestedTableGroupJoin (append semantics) when exact positioning is not required.","If no custom from-clause code exists, upgrade and report an HHH issue with the stack trace."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Before positioned insertion, confirm the anchor path exists in the group (reference equality!)\nboolean anchorPresent = group.getTableGroupJoins().stream()\n    .anyMatch( j -> j.getNavigablePath() == anchorPath );\nif ( !anchorPresent ) {\n    group.addTableGroupJoin( join ); // plain append instead of positioned insert\n}","typeGuard":null,"tryCatchPattern":"try {\n    group.addTableGroupJoin( positionedJoin );\n} catch ( NoSuchElementException e ) {\n    if ( e.getMessage() != null && e.getMessage().startsWith(\"Table group for navigable path not found\") ) {\n        // anchor join missing: add it first, then retry the positioned insert\n        ensureAnchorJoin( group, anchorPath );\n        group.addTableGroupJoin( positionedJoin );\n    } else {\n        throw e;\n    }\n}","preventionTips":["Create joins bottom-up: add the join owning a navigable path before positioning others relative to it.","Reuse the exact NavigablePath instances already present in the from-clause; the lookup uses reference equality.","Prefer append-style addTableGroupJoin/addNestedTableGroupJoin unless ordering is a hard requirement."],"tags":["internal","sql-ast","from-clause","navigable-path"],"backgroundTag":"sql-ast-internal-invariant","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}