hibernate/hibernate-orm · error · QueryException
No column for interpolation '%s'
Error message
No column for interpolation '%s'
What it means
When a legacy native query interpolates '{alias.property}', SQLQueryParser.validate checks the resolved column aliases. If the property maps to no column at all (null or empty array) it throws QueryException — the token cannot be replaced by any column name, which almost always means the property name is unknown for that alias/suffix.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/query/sql/internal/SQLQueryParser.java:279
}
aliasesFound++;
return persister.selectFragment( aliasName, suffix ) ;
}
else {
// Let return-properties override whatever the persister has for aliases.
String[] columnAliases = fieldResults.get( propertyName );
if ( columnAliases == null ) {
columnAliases = persister.getSubclassPropertyColumnAliases( propertyName, suffix );
}
validate( aliasName, propertyName, columnAliases, token );
aliasesFound++;
return columnAliases[0];
}
}
private void validate(String aliasName, String propertyName, String[] columnAliases, String token) {
if ( columnAliases == null || columnAliases.length == 0 ) {
throw new QueryException(
"No column for interpolation '%s'"
.formatted( token ),
originalQueryString
);
}
if ( columnAliases.length != 1 ) {
throw new QueryException(
"Multiple columns for interpolation '%s' ('%s' is mapped to %s columns)"
.formatted( token, propertyName, columnAliases.length ),
originalQueryString
);
}
}
}
View on GitHub (pinned to fad1729dce)
Solutions
- Correct the property name in {alias.property} to a real mapped property of that alias's entity.
- If the property lives on a subclass, map the return for the subclass alias instead.
- If you need a custom column, declare it via addProperty/@FieldResult for that alias and interpolate by property name.
Example fix
-- before (Employee has 'salary', not 'wage')
select {e.wage} from employee e
-- after
select {e.salary} from employee e Defensive patterns
Strategy: try-catch
Validate before calling
// optional pre-check against the metamodel when you have the entity class:
static boolean propertyIsMapped(org.hibernate.persister.entity.EntityPersister p, String prop) {
return p.getSubclassPropertyIndex(prop) >= 0; // or check property names via p.getPropertyNames()
} Try / catch
try { query.list(); } catch (org.hibernate.QueryException e) { /* on 'No column for interpolation': print token, compare against entity property names, fix typo or add addProperty mapping */ throw e; } Prevention
- Derive {alias.prop} tokens from entity field names programmatically instead of typing them by hand.
- Validate interpolation tokens against the persister's property names in a startup test.
When it happens
Trigger: Using {e.wage} when the entity alias 'e' has no property 'wage' (typo, wrong entity, or property not included in the persister's subclass-property aliases for the mapping's suffix); referencing a property that exists on a subclass while the return maps the superclass.
Common situations: Typos in property names inside interpolation braces; renamed entity fields without updating native SQL; interpolating a property that is only mapped on a joined subclass; suffix mismatches after refactoring addEntity/addJoin mappings.
Related errors
- Unknown placeholder {token}
- Illegal interpolation '%s' ('%s' is a field alias)
- Multiple columns for interpolation '%s' ('%s' is mapped to %
- Named native query definition object is null
- Named native query definition name is null: {}
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/5a272a34495d53a3.
Report an issue: GitHub.