hibernate/hibernate-orm · info · CacheMetadataIncompleteException

Column unavailable at position: {}

Error message

Column unavailable at position: {}

What it means

Internal signal from CachedJdbcValuesMetadata.resolveColumnName(position): the cached metadata has no recorded name for that position (the slot is null, because CapturingJdbcValuesMetadata only records columns the mapping actually consumed at cache-write time). Like error 3195 it is a CacheMetadataIncompleteException, caught in JdbcSelectExecutorStandardImpl:401 to force a fresh SQL execution instead of using the incomplete cache hit.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/sql/results/jdbc/internal/CachedJdbcValuesMetadata.java:54

	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 ) {
			throw new CacheMetadataIncompleteException( "Column unavailable at position: " + position );
		}
		if ( explicitJavaType == null || type.getJavaTypeDescriptor() == explicitJavaType ) {
			//noinspection unchecked
			return (BasicType<J>) type;
		}
		else {

View on GitHub (pinned to fad1729dce)

Solutions

  1. No action needed in normal operation - Hibernate discards the cache hit and re-queries
  2. Evict the query-results cache and clear the query plan cache after schema or mapping changes
  3. Recreate the SessionFactory (restart) when the exception unexpectedly reaches application code

Example fix

// after schema/mapping change
sessionFactory.getQueryPlanCache().clear();
sessionFactory.getCache().evictQueryRegions();
Defensive patterns

Strategy: fallback

Prevention

When it happens

Trigger: A cached result set is asked for a column position that was not part of the mapping when the entry was cached; query plan evolution between cache put and hit; native query with a different column ordering than the cached entry assumed.

Common situations: Stale cached entries surviving a plan-relevant change (dialect upgrade, mapping change); test environments reusing a SessionFactory across schema resets; only visible if custom code bypasses the guarded path.

Related errors


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