hibernate/hibernate-orm · error · MappingException
property [" + propertyPath + "] not found on entity [" + ent
Error message
property [" + propertyPath + "] not found on entity [" + entityBinding.getEntityName() + "]
What it means
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.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/boot/query/HbmResultSetMappingDescriptor.java:600
value = collection.getElement();
break;
case "index":
if ( collection instanceof IndexedCollection indexedCollection ) {
value = indexedCollection.getIndex();
break;
}
default:
throw new MappingException( "property [" + element + "] not found on collection [" + collection.getRole() + "]" );
}
}
else {
throw new AssertionFailure( "Unexpected value" );
}
}
return value;
}
catch (MappingException e) {
throw new MappingException( "property [" + propertyPath + "] not found on entity [" + entityBinding.getEntityName() + "]" );
}
}
else if ( parent instanceof CollectionResultDescriptor descriptor ) {
final Collection collectionBinding =
collector.getCollectionBinding( descriptor.collectionPath.getFullPath() );
return collectionBinding.getElement();
}
else if ( parent instanceof JoinDescriptor joinDescriptor ) {
final HbmFetchParent joinParent =
joinDescriptor.fetchParentByAliasAccess.get()
.get( joinDescriptor.ownerTableAlias );
return getValue( joinParent, joinDescriptor.propertyPath + "." + propertyPath, context );
}
else {
throw new AssertionFailure( "Unexpected parent" );
}
}
View on GitHub (pinned to fad1729dce)
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).
Example fix
<!-- before: property is 'customer', not 'customr' -->
<return-join alias="c" property="o.customer">
<return-property name="customr.name" column="CUST_NAME"/>
</return-join>
<!-- after -->
<return-join alias="c" property="o.customer">
<return-property name="customer.name" column="CUST_NAME"/>
</return-join> Defensive patterns
Strategy: validation
Validate before calling
// after Metadata build, verify every return-property path against the metamodel:
ManagedDomainType<?> type = metadata.getTypeConfiguration().getMetadata().getEntityBinding( entityName );
// walk each dot segment via type.getAttribute(seg); fail with the offending segment name
for ( String seg : propertyPath.split( "\\." ) ) {
if ( type == null || !hasAttribute( type, seg ) ) {
throw new IllegalStateException( "Path " + propertyPath + " breaks at " + seg + " on " + entityName );
}
type = attributeTypeOf( type, seg );
} Try / catch
catch ( MappingException e ) {
if ( e.getMessage().startsWith( "property [" ) && e.getMessage().contains( "not found on entity" ) ) {
// message names the exact path and entity; compare against current mapped property names
}
} Prevention
- 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.
When it happens
Trigger: <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).
Common situations: 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.
Related errors
- Cannot combine other returns with a collection return (" + r
- Illegal <return-join/> property attribute: '" + fullProperty
- Entity <return/> mapping did not specify entity name
- Entity <return/> mapping did not specify alias
- property [" + element + "] not found on collection [" + coll
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/4bf3e2d5f09e82e9.
Report an issue: GitHub.