hibernate/hibernate-orm · error · IllegalArgumentException
Could not locate attribute mapping
Error message
Could not locate attribute mapping : {}.{} What it means
Lookup failure in Builders.attributeResult: the named entity has no attribute mapping for the given attribute path.
Solutions
- The attribute mapping could not be found on the entity. Verify the attribute name in the result mapping.
Defensive patterns
Strategy: validation
When it happens
Trigger: A runtime precondition of the Hibernate query API is violated: Could not locate attribute mapping : <value>.<value>
Common situations: Application code or configuration calls the query API in a way that violates its documented contract; the interpolated values in the message identify the offending input.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/621431609cf71a65.
Report an issue: GitHub.
Appendix: source
Thrown at hibernate-core/src/main/java/org/hibernate/query/results/internal/Builders.java:167
String entityName,
String attributePath,
SessionFactoryImplementor sessionFactory) {
if ( attributePath.contains( "." ) ) {
throw new UnsupportedOperationException(
"Support for defining a NativeQuery attribute result based on a composite path is not yet implemented"
);
}
final MappingMetamodelImplementor mappingMetamodel = sessionFactory.getMappingMetamodel();
final String fullEntityName = mappingMetamodel.getImportedName( entityName );
final EntityPersister entityMapping = mappingMetamodel.findEntityDescriptor( fullEntityName );
if ( entityMapping == null ) {
throw new IllegalArgumentException( "Could not locate entity mapping : " + fullEntityName );
}
final AttributeMapping attributeMapping = entityMapping.findAttributeMapping( attributePath );
if ( attributeMapping == null ) {
throw new IllegalArgumentException( "Could not locate attribute mapping : " + fullEntityName + "." + attributePath );
}
if ( attributeMapping instanceof SingularAttributeMapping singularAttributeMapping ) {
return new DynamicResultBuilderAttribute( singularAttributeMapping, columnAlias, fullEntityName, attributePath );
}
throw new IllegalArgumentException(
String.format(
Locale.ROOT,
"Specified attribute mapping [%s.%s] not a basic attribute: %s",
fullEntityName,
attributePath,
attributeMapping
)
);
}
public static ResultBuilder attributeResult(View on GitHub (pinned to fad1729dce)