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

  1. Correct the property name in {alias.property} to a real mapped property of that alias's entity.
  2. If the property lives on a subclass, map the return for the subclass alias instead.
  3. 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

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


AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22). Data as JSON: /api/errors/5a272a34495d53a3. Report an issue: GitHub.