{"record":{"id":"506cdbdca1997409","repo":"hibernate/hibernate-orm","slug":"unexpected-table-group-type-for-onetomanycollectio","errorCode":null,"errorMessage":"Unexpected table group type for OneToManyCollectionPart: %s","messagePattern":"Unexpected table group type for OneToManyCollectionPart: (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/OneToManyCollectionPart.java","lineNumber":211,"sourceCode":"\t\t\t\t\tnavigablePath,\n\t\t\t\t\tfetched,\n\t\t\t\t\taddsPredicate,\n\t\t\t\t\tcreationState\n\t\t\t);\n\t\t}\n\t\telse if ( lhs instanceof OneToManyTableGroup otmTableGroup ) {\n\t\t\tfinal var elementTableGroup = otmTableGroup.getElementTableGroup();\n\t\t\tfinal var tableGroupJoin = new TableGroupJoin( navigablePath, joinType, elementTableGroup );\n\t\t\treturn withMapKeyJoin( tableGroupJoin,\n\t\t\t\t\telementTableGroup,\n\t\t\t\t\tnavigablePath,\n\t\t\t\t\tfetched,\n\t\t\t\t\taddsPredicate,\n\t\t\t\t\tcreationState\n\t\t\t);\n\t\t}\n\t\telse {\n\t\t\tthrow new IllegalStateException(\n\t\t\t\t\t\"Unexpected table group type for OneToManyCollectionPart: \" + lhs.getClass().getName()\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate TableGroupJoin withMapKeyJoin(\n\t\t\tTableGroupJoin tableGroupJoin,\n\t\t\tTableGroup elementTableGroup,\n\t\t\tNavigablePath navigablePath,\n\t\t\tboolean fetched,\n\t\t\tboolean addsPredicate,\n\t\t\tSqlAstCreationState creationState) {\n\t\tif ( mapKeyPropertyName != null ) {\n\t\t\tfinal var elementPart =\n\t\t\t\t\t(EntityCollectionPart)\n\t\t\t\t\t\t\tgetCollectionDescriptor().getAttributeMapping()\n\t\t\t\t\t\t\t\t\t.getElementDescriptor();\n\t\t\tif ( elementPart.getAssociatedEntityMappingType().findAttributeMapping( mapKeyPropertyName )","sourceCodeStart":193,"sourceCodeEnd":229,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/OneToManyCollectionPart.java#L193-L229","documentation":"Error \"Unexpected table group type for OneToManyCollectionPart: %s\" thrown in hibernate/hibernate-orm.","triggerScenarios":"Thrown when a one-to-many collection part is resolved against a table group of an unexpected type during SQL generation.","commonSituations":"See trigger scenarios.","solutions":["This indicates an internal mismatch; simplify the query (avoid the exotic fetch/join shape) or report it to Hibernate with a reproducer."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}