hibernate/hibernate-orm · info · CacheMetadataIncompleteException
Column unavailable with name: {}
Error message
Column unavailable with name: {} What it means
Internal control-flow exception: CachedJdbcValuesMetadata - the result-set metadata stored alongside cached JDBC values - does not contain the requested column name. Hibernate throws CacheMetadataIncompleteException when the current result mapping needs a column the cached metadata never captured, and JdbcSelectExecutorStandardImpl (line 401) catches it and simply re-executes the query against the database. Users should essentially never see it; if it escapes to user code, the cached-results metadata is inconsistent with the query plan.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/sql/results/jdbc/internal/CachedJdbcValuesMetadata.java:47
public JavaType<?> getStoredJavaType(int columnIndex) {
final var type = types[columnIndex];
return type != null ? type.getJavaTypeDescriptor() : null;
}
@Override
public int getColumnCount() {
return columnNames.length;
}
@Override
public int resolveColumnPosition(String columnName) {
for ( int i = 0; i < columnNames.length; i++ ) {
if ( columnName.equalsIgnoreCase( columnNames[i] ) ) {
return i + 1;
}
}
throw new CacheMetadataIncompleteException( "Column unavailable with name: " + columnName );
}
@Override
public String resolveColumnName(int position) {
final String name = columnNames[position - 1];
if ( name == null ) {
throw new CacheMetadataIncompleteException( "Column unavailable at position: " + position );
}
return name;
}
@Override
public <J> BasicType<J> resolveType(
int position,
JavaType<J> explicitJavaType,
TypeConfiguration typeConfiguration) {
final var type = types[position - 1];
if ( type == null ) {View on GitHub (pinned to fad1729dce)
Solutions
- Nothing in normal operation - the library already falls back to executing the SQL
- Clear the query caches: `sessionFactory.getQueryPlanCache().clear()` and evict the query-results cache region, then retry
- Ensure all nodes run the same Hibernate version and restart the SessionFactory after upgrades/schema changes so caches are rebuilt consistently
Example fix
// handle unexpected escape + preventive cache clear sessionFactory.getQueryPlanCache().clear(); sessionFactory.getCache().evictQueryRegions();
Defensive patterns
Strategy: fallback
Prevention
- Treat this exception as internal - Hibernate already falls back to re-executing the query
- After upgrading Hibernate, dialect, or schema, clear the query plan cache and evict query cache regions
- Restart the SessionFactory on deploy so in-memory cached metadata cannot outlive its plan
When it happens
Trigger: Query-results cache entry written by a plan capturing only the columns it used, later hit by a mapping that needs an additional column; plan or dialect changed between cache put and hit (version upgrade, schema change) while stale cached results remain; only reachable via code paths outside JdbcSelectExecutorStandardImpl's guarded resolve.
Common situations: Rolling upgrades where nodes run different Hibernate versions against the same data; stale in-memory caches after a hot redeploy without factory restart; custom code that calls resolveColumnPosition on cached metadata directly.
Related errors
- Column unavailable at position: {}
- Could not create connection
- Could not create connection
- Could not configure c3p0: " + e.getMessage()
- JDBC Driver class " + jdbcDriverClass + " not found
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/8cc30dcc6660fbd6.
Report an issue: GitHub.