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

  1. Open the embeddable and confirm the exact field name (case-sensitive) the mapping should target.
  2. Fix the referencing mapping - @AttributeOverride(name=...), property-ref value, or hbm element name - to match the field.
  3. If the field was renamed deliberately, update every override and mapping reference in the same change.
  4. 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

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


AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22). Data as JSON: /api/errors/c53255b6e5376e1c. Report an issue: GitHub.