hibernate/hibernate-orm · error · QueryException
Multiple columns for interpolation '%s' ('%s' is mapped to %
Error message
Multiple columns for interpolation '%s' ('%s' is mapped to %s columns) What it means
The sibling of the no-column check: if '{alias.property}' resolves to more than one column alias (the property is a composite/embedded type or otherwise spans several columns), validate() throws QueryException. A single interpolation token can only stand for exactly one column, so multi-column properties cannot be interpolated as a unit.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/query/sql/internal/SQLQueryParser.java:286
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
- Interpolate the single-column sub-properties instead ({e.address.street}, {e.address.city}, ...).
- Or select the underlying columns directly in SQL and map them via addScalar/addProperty.
- Drop interpolation for that attribute and let {alias.*} expand the whole persister fragment.
Example fix
-- before (address is an @Embedded spanning street, city, zip)
select {e.address} from employee e
-- after
select {e.address.street}, {e.address.city}, {e.address.zip} from employee e Defensive patterns
Strategy: try-catch
Try / catch
try { query.list(); } catch (org.hibernate.QueryException e) { /* on 'Multiple columns for interpolation': expand {e.embedded} into its single-column sub-properties {e.embedded.a}, {e.embedded.b} */ throw e; } Prevention
- Never interpolate embedded/composite properties as one token — always their scalar sub-properties.
- Check the persister's property column count when generating interpolation SQL.
When it happens
Trigger: Interpolating {e.address} where Address is an embeddable mapped to several columns (street, city, zip); interpolating any property whose persister property column aliases array has length > 1, e.g. composite user types or multi-column basic types like currency+amount.
Common situations: Entities with @Embedded attributes referenced via legacy {alias.*}-style interpolation; migration from Hibernate 5 where multi-column interpolation was handled differently; custom UserType spanning multiple columns.
Related errors
- Unknown placeholder {token}
- Illegal interpolation '%s' ('%s' is a field alias)
- No column for interpolation '%s'
- 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/bcfc359a6ff7d41e.
Report an issue: GitHub.