{"record":{"id":"d14a8e3f57b3074c","repo":"hibernate/hibernate-orm","slug":"property-ref-to-unmapped-class","errorCode":null,"errorMessage":"property-ref to unmapped class: {}","messagePattern":"property-ref to unmapped class: (.+?)","errorType":"exception","errorClass":"MappingException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/internal/InFlightMetadataCollectorImpl.java","lineNumber":1361,"sourceCode":"\t\treturn propertyRefResolver == null ? null : propertyRefResolver.get( entityName + \".\" + propertyName );\n\t}\n\n\tprivate static class DelayedPropertyReferenceHandlerAnnotationImpl implements DelayedPropertyReferenceHandler {\n\t\tpublic final String referencedClass;\n\t\tpublic final String propertyName;\n\t\tpublic final boolean unique;\n\n\t\tpublic DelayedPropertyReferenceHandlerAnnotationImpl(String referencedClass, String propertyName, boolean unique) {\n\t\t\tthis.referencedClass = referencedClass;\n\t\t\tthis.propertyName = propertyName;\n\t\t\tthis.unique = unique;\n\t\t}\n\n\t\t@Override\n\t\tpublic void process(InFlightMetadataCollector metadataCollector) {\n\t\t\tfinal var persistentClass = metadataCollector.getEntityBinding( referencedClass );\n\t\t\tif ( persistentClass == null ) {\n\t\t\t\tthrow new MappingException( \"property-ref to unmapped class: \" + referencedClass );\n\t\t\t}\n\n\t\t\tfinal var property = persistentClass.getReferencedProperty( propertyName );\n\t\t\tif ( unique ) {\n\t\t\t\t( (SimpleValue) property.getValue() ).setAlternateUniqueKey( true );\n\t\t\t}\n\t\t}\n\t}\n\n\t@Override\n\tpublic void addPropertyReference(String referencedClass, String propertyName) {\n\t\taddDelayedPropertyReferenceHandler(\n\t\t\t\tnew DelayedPropertyReferenceHandlerAnnotationImpl( referencedClass, propertyName, false )\n\t\t);\n\t}\n\n\t@Override\n\tpublic void addDelayedPropertyReferenceHandler(DelayedPropertyReferenceHandler handler) {","sourceCodeStart":1343,"sourceCodeEnd":1379,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/internal/InFlightMetadataCollectorImpl.java#L1343-L1379","documentation":"Error \"property-ref to unmapped class: {}\" thrown in hibernate/hibernate-orm.","triggerScenarios":"A property-ref refers to a class that is not a mapped entity.","commonSituations":"hbm.xml property-ref attributes pointing at a class missing from the mapping metadata, or a typo in the class name.","solutions":["Ensure the class referenced by property-ref in the hbm/mapping is actually mapped as an entity.","Fix typos in the entity/class name used by the property-ref attribute.","Check that the referenced entity's mapping file or annotated class is included in the session factory's mapping resources."],"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"}