{"record":{"id":"f465eea41eb7e1ec","repo":"hibernate/hibernate-orm","slug":"collection-role-is-mappedby-a-property-named","errorCode":null,"errorMessage":"Collection '<role>' is 'mappedBy' a property named '<mappedBy>' which does not exist in the target entity '<entityName>'","messagePattern":"Collection '<role>' is 'mappedBy' a property named '<mappedBy>' which does not exist in the target entity '<entityName>'","errorType":"exception","errorClass":"AnnotationException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/model/internal/CollectionBinder.java","lineNumber":1587,"sourceCode":"\t\t\tTypeDetails elementType,\n\t\t\tPersistentClass persistentClass,\n\t\t\tMap<String, PersistentClass> persistentClasses) {\n\t\tif ( persistentClass != null && isUnownedCollection() ) {\n\t\t\tfinal var mappedByProperty = getMappedByProperty( elementType, persistentClass );\n\t\t\tcheckMappedByType( mappedBy, mappedByProperty.getValue(), propertyName, propertyHolder, persistentClasses );\n\t\t\treturn persistentClass.getJoinNumber( mappedByProperty ) != 0;\n\t\t}\n\t\telse {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tprivate Property getMappedByProperty(TypeDetails elementType, PersistentClass persistentClass) {\n\t\ttry {\n\t\t\treturn persistentClass.getRecursiveProperty( mappedBy );\n\t\t}\n\t\tcatch (MappingException e) {\n\t\t\tthrow new AnnotationException(\n\t\t\t\t\t\"Collection '\" + safeCollectionRole()\n\t\t\t\t\t+ \"' is 'mappedBy' a property named '\" + mappedBy\n\t\t\t\t\t+ \"' which does not exist in the target entity '\" + elementType.getName() + \"'\"\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate boolean noAssociationTable(Map<String, PersistentClass> persistentClasses) {\n\t\tfinal var persistentClass = persistentClasses.get( getElementType().getName() );\n\t\treturn persistentClass != null\n\t\t\t&& !isReversePropertyInJoin( getElementType(), persistentClass, persistentClasses )\n\t\t\t&& oneToMany\n\t\t\t&& !isExplicitAssociationTable\n\t\t\t&& ( implicitJoinColumn() || explicitForeignJoinColumn() );\n\t}\n\n\tprivate boolean implicitJoinColumn() {\n\t\treturn joinColumns.getJoinColumns().get(0).isImplicit()","sourceCodeStart":1569,"sourceCodeEnd":1605,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/model/internal/CollectionBinder.java#L1569-L1605","documentation":"Error \"Collection '<role>' is 'mappedBy' a property named '<mappedBy>' which does not exist in the target entity '<entityName>'\" 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":["Correct the mappedBy value to the name of an existing property in the target entity.","Or add the missing property to the target entity."],"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"}