{"record":{"id":"4bf3e2d5f09e82e9","repo":"hibernate/hibernate-orm","slug":"property-propertypath-not-found-on-entit","errorCode":null,"errorMessage":"property [\" + propertyPath + \"] not found on entity [\" + entityBinding.getEntityName() + \"]","messagePattern":"property \\[\" \\+ propertyPath \\+ \"\\] not found on entity \\[\" \\+ entityBinding\\.getEntityName\\(\\) \\+ \"\\]","errorType":"exception","errorClass":"MappingException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/query/HbmResultSetMappingDescriptor.java","lineNumber":600,"sourceCode":"\t\t\t\t\t\t\t\t\tvalue = collection.getElement();\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\tcase \"index\":\n\t\t\t\t\t\t\t\t\tif ( collection instanceof IndexedCollection indexedCollection ) {\n\t\t\t\t\t\t\t\t\t\tvalue = indexedCollection.getIndex();\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\tthrow new MappingException( \"property [\" + element + \"] not found on collection [\" + collection.getRole() + \"]\" );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tthrow new AssertionFailure( \"Unexpected value\" );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn value;\n\t\t\t\t}\n\t\t\t\tcatch (MappingException e) {\n\t\t\t\t\tthrow new MappingException( \"property [\" + propertyPath + \"] not found on entity [\" + entityBinding.getEntityName() + \"]\" );\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if ( parent instanceof CollectionResultDescriptor descriptor ) {\n\t\t\t\tfinal Collection collectionBinding =\n\t\t\t\t\t\tcollector.getCollectionBinding( descriptor.collectionPath.getFullPath() );\n\t\t\t\treturn collectionBinding.getElement();\n\t\t\t}\n\t\t\telse if ( parent instanceof JoinDescriptor joinDescriptor ) {\n\t\t\t\tfinal HbmFetchParent joinParent =\n\t\t\t\t\t\tjoinDescriptor.fetchParentByAliasAccess.get()\n\t\t\t\t\t\t\t\t.get( joinDescriptor.ownerTableAlias );\n\t\t\t\treturn getValue( joinParent, joinDescriptor.propertyPath + \".\" + propertyPath, context );\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthrow new AssertionFailure( \"Unexpected parent\" );\n\t\t\t}\n\t\t}\n","sourceCodeStart":582,"sourceCodeEnd":618,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/query/HbmResultSetMappingDescriptor.java#L582-L618","documentation":"This is the catch-all MappingException from getValue(): when resolving a return-property path against the owner entity binding, any MappingException raised inside the loop (a property part that does not exist, or the collection-part error 747) is caught and re-thrown as 'property [fullPropertyPath] not found on entity [...]'. The path you declared in <return-property name=.../> cannot be walked over the entity's mapped structure.","triggerScenarios":"<return-property name=\"customr\" .../> (typo) on an entity whose property is 'customer'; multi-part paths where an intermediate name is wrong, e.g. 'adress.zip'; paths continued through a collection without the key/element/index segment (the original 747 error surfaces as this message).","commonSituations":"Renamed entity properties not propagated to native query mappings; mappings written against an older version of the domain model; collection joins written in HQL syntax rather than collection-part syntax.","solutions":["Check the exact property path against the entity's mapped property names (case-sensitive) and fix the typo or stale segment.","For paths crossing a collection, insert key/element/index as the segment right after the collection name.","If a composite/embedded path is used, verify every intermediate segment is a mapped component or association.","Verify you referenced the right owner entity (the one whose alias precedes the path)."],"exampleFix":"<!-- before: property is 'customer', not 'customr' -->\n<return-join alias=\"c\" property=\"o.customer\">\n    <return-property name=\"customr.name\" column=\"CUST_NAME\"/>\n</return-join>\n\n<!-- after -->\n<return-join alias=\"c\" property=\"o.customer\">\n    <return-property name=\"customer.name\" column=\"CUST_NAME\"/>\n</return-join>","handlingStrategy":"validation","validationCode":"// after Metadata build, verify every return-property path against the metamodel:\nManagedDomainType<?> type = metadata.getTypeConfiguration().getMetadata().getEntityBinding( entityName );\n// walk each dot segment via type.getAttribute(seg); fail with the offending segment name\nfor ( String seg : propertyPath.split( \"\\\\.\" ) ) {\n    if ( type == null || !hasAttribute( type, seg ) ) {\n        throw new IllegalStateException( \"Path \" + propertyPath + \" breaks at \" + seg + \" on \" + entityName );\n    }\n    type = attributeTypeOf( type, seg );\n}","typeGuard":null,"tryCatchPattern":"catch ( MappingException e ) {\n    if ( e.getMessage().startsWith( \"property [\" ) && e.getMessage().contains( \"not found on entity\" ) ) {\n        // message names the exact path and entity; compare against current mapped property names\n    }\n}","preventionTips":["After renaming any entity property, grep hbm.xml for return-property name attributes referencing it.","Keep a metadata-boot integration test per mapping file.","Remember collection paths need the key/element/index segment, otherwise they surface as this generic message."],"tags":["hibernate","hbm-xml","native-query","property-path","boot"],"backgroundTag":"property-not-found-in-mapping","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}