{"record":{"id":"378e308137ca322d","repo":"hibernate/hibernate-orm","slug":"association-s-for-entity-s-references-unmapp","errorCode":null,"errorMessage":"Association [%s] for entity [%s] references unmapped class [%s]","messagePattern":"Association \\[(.+?)\\] for entity \\[(.+?)\\] references unmapped class \\[(.+?)\\]","errorType":"exception","errorClass":"MappingException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/model/internal/CollectionBinder.java","lineNumber":1633,"sourceCode":"\t */\n\tprotected void bindOneToManySecondPass(Map<String, PersistentClass> persistentClasses) {\n\t\tif ( property == null ) {\n\t\t\tthrow new AssertionFailure( \"Null property\" );\n\t\t}\n\n\t\tlogOneToManySecondPass();\n\n\t\tfinal var oneToMany =\n\t\t\t\tnew org.hibernate.mapping.OneToMany( buildingContext, getCollection().getOwner() );\n\t\tcollection.setElement( oneToMany );\n\t\toneToMany.setReferencedEntityName( getElementType().getName() );\n\t\toneToMany.setNotFoundAction( notFoundAction );\n\n\t\tfinal String referencedEntityName = oneToMany.getReferencedEntityName();\n\t\tfinal var associatedClass = persistentClasses.get( referencedEntityName );\n\t\thandleJpaOrderBy( collection, associatedClass );\n\t\tif ( associatedClass == null ) {\n\t\t\tthrow new MappingException(\n\t\t\t\t\tString.format( \"Association [%s] for entity [%s] references unmapped class [%s]\",\n\t\t\t\t\t\t\tpropertyName, propertyHolder.getClassName(), referencedEntityName )\n\t\t\t);\n\t\t}\n\t\toneToMany.setAssociatedClass( associatedClass );\n\n\t\tfinal var joins = getMetadataCollector().getJoins( referencedEntityName );\n\t\tforeignJoinColumns.setPropertyHolder( buildPropertyHolder(\n\t\t\t\tassociatedClass,\n\t\t\t\tjoins,\n\t\t\t\tforeignJoinColumns.getBuildingContext(),\n\t\t\t\tinheritanceStatePerClass\n\t\t) );\n\t\tforeignJoinColumns.setJoins( joins );\n\t\tfinal var collectionTable =\n\t\t\t\tforeignJoinColumns.hasMappedBy()\n\t\t\t\t\t\t? associatedClass.getRecursiveProperty( foreignJoinColumns.getMappedBy() )\n\t\t\t\t\t\t\t\t.getValue().getTable()","sourceCodeStart":1615,"sourceCodeEnd":1651,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/model/internal/CollectionBinder.java#L1615-L1651","documentation":"Error \"Association [%s] for entity [%s] references unmapped class [%s]\" thrown in hibernate/hibernate-orm.","triggerScenarios":"An association or reference targets a type that Hibernate has not mapped as an entity.","commonSituations":"Missing @Entity on the target class, the class not being scanned into the persistence unit, or a typo in the entity name.","solutions":["Map the referenced class as an entity (add @Entity and include it in the persistence unit).","Or fix the association target to an already-mapped class."],"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"}