{"record":{"id":"c53255b6e5376e1c","repo":"hibernate/hibernate-orm","slug":"component-property-not-found","errorCode":null,"errorMessage":"component: {} property not found: {}","messagePattern":"component: (.+?) property not found: (.+?)","errorType":"exception","errorClass":"MappingException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/mapping/Component.java","lineNumber":623,"sourceCode":"\t * Returns the {@link Property} at the specified position in this {@link Component}.\n\t *\n\t * @param index index of the {@link Property} to return\n\t * @return {@link Property}\n\t * @throws IndexOutOfBoundsException - if the index is out of range(index &lt; 0 || index &gt;=\n\t * {@link #getPropertySpan()})\n\t */\n\tpublic Property getProperty(int index) {\n\t\treturn properties.get( index );\n\t}\n\n\t@Override\n\tpublic Property getProperty(String propertyName) throws MappingException {\n\t\tfor ( var property : properties ) {\n\t\t\tif ( property.getName().equals(propertyName) ) {\n\t\t\t\treturn property;\n\t\t\t}\n\t\t}\n\t\tthrow new MappingException(\"component: \" + componentClassName + \" property not found: \" + propertyName);\n\t}\n\n\tpublic boolean matchesAllProperties(String... propertyNames) {\n\t\treturn properties.size() == propertyNames.length &&\n\t\t\t\tnew HashSet<>(properties.stream().map(Property::getName)\n\t\t\t\t\t\t.collect(toList()))\n\t\t\t\t\t\t.containsAll(List.of(propertyNames));\n\t}\n\n\tpublic boolean hasProperty(String propertyName) {\n\t\tfor ( var property : properties ) {\n\t\t\tif ( property.getName().equals(propertyName) ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n","sourceCodeStart":605,"sourceCodeEnd":641,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/mapping/Component.java#L605-L641","documentation":"Component#getProperty(String) walks the embeddable's declared properties and throws when none matches the requested name. Hibernate calls this while binding and validating mappings whenever it must resolve a sub-property path inside a component (attribute overrides, property references, ids). The error signals a name mismatch between a mapping fragment and the embeddable's fields.","triggerScenarios":"An @AttributeOverride/@AssociationOverride using a wrong sub-property name; a property-ref or hbm mapping pointing at a component sub-property that does not exist; a field renamed in the embeddable while the referencing mapping kept the old name; case-sensitivity typos such as 'eMail' vs 'email'.","commonSituations":"Renaming embeddable fields during refactoring; splitting or merging embeddables; hand-written hbm files drifting from annotated classes; copy-pasted override annotations between embeddables.","solutions":["Open the embeddable and confirm the exact field name (case-sensitive) the mapping should target.","Fix the referencing mapping - @AttributeOverride(name=...), property-ref value, or hbm element name - to match the field.","If the field was renamed deliberately, update every override and mapping reference in the same change.","Rebuild so the deployed mapping and classes are in sync."],"exampleFix":"// before - embeddable field is 'street'\n@AttributeOverride(name = \"streett\", column = @Column(name = \"street\"))\n\n// after\n@AttributeOverride(name = \"street\", column = @Column(name = \"street\"))","handlingStrategy":"validation","validationCode":"// verify an override target exists on the embeddable before boot\nstatic boolean embeddableHasProperty(Class<?> embeddable, String name) {\n    for (Field f : embeddable.getDeclaredFields()) {\n        if (f.getName().equals(name)) {\n            return true;\n        }\n    }\n    return false;\n}","typeGuard":null,"tryCatchPattern":"try {\n    metadata = sources.buildMetadata();\n} catch (MappingException e) {\n    // message pattern: 'component: <class> property not found: <name>'\n    // grep mappings and @AttributeOverride declarations for the printed name\n    throw e;\n}","preventionTips":["Treat embeddable field renames as API changes: search all mappings and overrides for the old name in the same commit.","Add a mapping unit test that builds Metadata for every annotated package.","Prefer annotation-based mappings so renames surface as compile errors or immediate validation failures."],"tags":["hibernate","orm","mapping","embeddable","property","attribute-override"],"backgroundTag":"property-not-found","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}