{"record":{"id":"12c1ad467ea7d877","repo":"hibernate/hibernate-orm","slug":"table-with-that-name-s-already-associated-with","errorCode":null,"errorMessage":"Table with that name [%s] already associated with entity","messagePattern":"Table with that name \\[(.+?)\\] already associated with entity","errorType":"exception","errorClass":"DuplicateSecondaryTableException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/internal/InFlightMetadataCollectorImpl.java","lineNumber":1486,"sourceCode":"\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t@Override\n\t\tpublic void addSecondaryTable(QualifiedTableName logicalQualifiedTableName, Join secondaryTableJoin) {\n\t\t\tfinal Identifier tableName = logicalQualifiedTableName.getTableName();\n\n\t\t\tif ( Identifier.areEqual(\n\t\t\t\ttoIdentifier(\n\t\t\t\t\tnew QualifiedTableName(\n\t\t\t\t\t\ttoIdentifier( primaryTable.getCatalog() ),\n\t\t\t\t\t\ttoIdentifier( primaryTable.getSchema() ),\n\t\t\t\t\t\tprimaryTableLogicalName\n\t\t\t\t\t).render()\n\t\t\t\t),\n\t\t\t\ttoIdentifier( logicalQualifiedTableName.render() ) ) ) {\n\t\t\t\tthrow new DuplicateSecondaryTableException( tableName );\n\t\t\t}\n\n\t\t\tif ( secondaryTableJoinMap == null ) {\n\t\t\t\t//secondaryTableJoinMap = new HashMap<Identifier,Join>();\n\t\t\t\t//secondaryTableJoinMap.put( logicalName, secondaryTableJoin );\n\t\t\t\tsecondaryTableJoinMap = new HashMap<>();\n\t\t\t\tsecondaryTableJoinMap.put( tableName.getCanonicalName(), secondaryTableJoin );\n\t\t\t}\n\t\t\telse {\n\t\t\t\t//final Join existing = secondaryTableJoinMap.put( logicalName, secondaryTableJoin );\n\t\t\t\tfinal Join existing =\n\t\t\t\t\t\tsecondaryTableJoinMap.put( tableName.getCanonicalName(), secondaryTableJoin );\n\t\t\t\tif ( existing != null ) {\n\t\t\t\t\tthrow new DuplicateSecondaryTableException( tableName );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n","sourceCodeStart":1468,"sourceCodeEnd":1504,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/internal/InFlightMetadataCollectorImpl.java#L1468-L1504","documentation":"Error \"Table with that name [%s] already associated with entity\" thrown in hibernate/hibernate-orm.","triggerScenarios":"The same table name is bound twice to an entity's secondary/primary tables.","commonSituations":"Declaring a @SecondaryTable whose name collides with the primary table or another secondary table of the entity.","solutions":["Remove the duplicate table binding; each table name can be associated with an entity only once (check @SecondaryTable and @Table definitions).","Rename one of the conflicting table declarations if two distinct tables were intended.","Check for duplicate mapping of the same class via both annotations and hbm.xml."],"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"}