{"record":{"id":"364f21785f5ea840","repo":"hibernate/hibernate-orm","slug":"association-is-mappedby-another-entity-and-364f21","errorCode":null,"errorMessage":"Association '{}' is 'mappedBy' another entity and may not specify the '@JoinTable'","messagePattern":"Association '(.+?)' is 'mappedBy' another entity and may not specify the '@JoinTable'","errorType":"exception","errorClass":"AnnotationException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/model/internal/CollectionBinder.java","lineNumber":1196,"sourceCode":"\tprivate void bindCache() {\n\t\t//set cache\n\t\tif ( isNotBlank( cacheConcurrencyStrategy ) ) {\n\t\t\tcollection.setCacheConcurrencyStrategy( cacheConcurrencyStrategy );\n\t\t\tcollection.setCacheRegionName( cacheRegionName );\n\t\t}\n\t\tcollection.setQueryCacheLayout( queryCacheLayout );\n\t}\n\n\tprivate void detectMappedByProblem(boolean isMappedBy) {\n\t\tif ( isMappedBy ) {\n\t\t\tif ( property.hasDirectAnnotationUsage( JoinColumn.class )\n\t\t\t\t\t|| property.hasDirectAnnotationUsage( JoinColumns.class ) ) {\n\t\t\t\tthrow new AnnotationException( \"Association '\"\n\t\t\t\t\t\t+ qualify( propertyHolder.getPath(), propertyName )\n\t\t\t\t\t\t+ \"' is 'mappedBy' another entity and may not specify the '@JoinColumn'\" );\n\t\t\t}\n\t\t\tif ( propertyHolder.getJoinTable( property ) != null ) {\n\t\t\t\tthrow new AnnotationException( \"Association '\"\n\t\t\t\t\t\t+ qualify( propertyHolder.getPath(), propertyName )\n\t\t\t\t\t\t+ \"' is 'mappedBy' another entity and may not specify the '@JoinTable'\" );\n\t\t\t}\n\t\t\tif ( oneToMany ) {\n\t\t\t\tif ( property.hasDirectAnnotationUsage( MapKeyColumn.class ) ) {\n\t\t\t\t\tBOOT_LOGGER.mappedByShouldNotSpecifyMapKeyColumn(\n\t\t\t\t\t\t\tqualify( propertyHolder.getPath(), propertyName )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif ( property.hasDirectAnnotationUsage( OrderColumn.class ) ) {\n\t\t\t\t\tBOOT_LOGGER.mappedByShouldNotSpecifyOrderColumn(\n\t\t\t\t\t\t\tqualify( propertyHolder.getPath(), propertyName )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif ( property.hasDirectAnnotationUsage( MapKeyColumn.class ) ) {\n\t\t\t\t\tthrow new AnnotationException( \"Association '\"","sourceCodeStart":1178,"sourceCodeEnd":1214,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/model/internal/CollectionBinder.java#L1178-L1214","documentation":"Error \"Association '{}' is 'mappedBy' another entity and may not specify the '@JoinTable'\" thrown in hibernate/hibernate-orm.","triggerScenarios":"An association declares 'mappedBy' naming a property that does not exist, has the wrong type, or is not the owning side on the target entity.","commonSituations":"Bidirectional associations where mappedBy is misspelled, both sides claim ownership, or the target entity was refactored without updating the mapping.","solutions":["Remove @JoinTable from the unowned (mappedBy) side; the owning side declares the join table."],"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"}