hibernate/hibernate-orm · error · IllegalArgumentException
Specified attribute mapping [%s.%s] not a basic attribute: %
Error message
Specified attribute mapping [%s.%s] not a basic attribute: %s
What it means
Error "Specified attribute mapping [%s.%s] not a basic attribute: %s" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/query/results/internal/Builders.java:174
}
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(
String columnAlias,
SingularAttribute<?, ?> attribute,
SessionFactoryImplementor sessionFactory) {
if ( ! ( attribute.getDeclaringType() instanceof EntityType<?> entityType ) ) {
throw new UnsupportedOperationException(
"Support for defining a NativeQuery attribute result based on a composite path is not yet implemented"
);View on GitHub (pinned to fad1729dce)
Solutions
- The mapped attribute is not basic. Use a basic (column-mapped) attribute for this result mapping.
When it happens
Trigger: A runtime precondition of the Hibernate query API is violated: Specified attribute mapping [<value>.<value>] not a basic attribute: <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/b2396dd0c23804bb.
Report an issue: GitHub.