hibernate/hibernate-orm · error · MappingException
component: {} property not found: {}
Error message
component: {} property not found: {} What it means
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.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/mapping/Component.java:623
* Returns the {@link Property} at the specified position in this {@link Component}.
*
* @param index index of the {@link Property} to return
* @return {@link Property}
* @throws IndexOutOfBoundsException - if the index is out of range(index < 0 || index >=
* {@link #getPropertySpan()})
*/
public Property getProperty(int index) {
return properties.get( index );
}
@Override
public Property getProperty(String propertyName) throws MappingException {
for ( var property : properties ) {
if ( property.getName().equals(propertyName) ) {
return property;
}
}
throw new MappingException("component: " + componentClassName + " property not found: " + propertyName);
}
public boolean matchesAllProperties(String... propertyNames) {
return properties.size() == propertyNames.length &&
new HashSet<>(properties.stream().map(Property::getName)
.collect(toList()))
.containsAll(List.of(propertyNames));
}
public boolean hasProperty(String propertyName) {
for ( var property : properties ) {
if ( property.getName().equals(propertyName) ) {
return true;
}
}
return false;
}
View on GitHub (pinned to fad1729dce)
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.
Example fix
// before - embeddable field is 'street' @AttributeOverride(name = "streett", column = @Column(name = "street")) // after @AttributeOverride(name = "street", column = @Column(name = "street"))
Defensive patterns
Strategy: validation
Validate before calling
// verify an override target exists on the embeddable before boot
static boolean embeddableHasProperty(Class<?> embeddable, String name) {
for (Field f : embeddable.getDeclaredFields()) {
if (f.getName().equals(name)) {
return true;
}
}
return false;
} Try / catch
try {
metadata = sources.buildMetadata();
} catch (MappingException e) {
// message pattern: 'component: <class> property not found: <name>'
// grep mappings and @AttributeOverride declarations for the printed name
throw e;
} Prevention
- 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.
When it happens
Trigger: 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'.
Common situations: Renaming embeddable fields during refactoring; splitting or merging embeddables; hand-written hbm files drifting from annotated classes; copy-pasted override annotations between embeddables.
Related errors
- Property '${path}' specifies ${columnCount} '@AttributeOverr
- Embeddable class not found: {}
- component type [{}] specifies {} properties for the instanti
- could not find property [{}] defined in the @Instantiator wi
- component type [{}] has {} properties but the instantiator o
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/c53255b6e5376e1c.
Report an issue: GitHub.