hibernate/hibernate-orm · error · MappingException

Unable to find column with physical name

Error message

Unable to find column with physical name '{}' in table '{}'

What it means

Mirror of the logical lookup: getLogicalColumnName walked the physical-to-logical binding map (including denormalized super-tables) and no property on the table maps a column with that physical name. The physical column name given has no known logical alias.

Solutions

  1. Verify the physical column name exists in the table metadata, accounting for quoting and case sensitivity.
  2. Check the applied PhysicalNamingStrategy; the physical name may differ from what you expect (e.g. snake_case conversion).
  3. Enable mapping debug logging to print the table's registered physical column names.
Defensive patterns

Strategy: validation

When it happens

Trigger: A referenced column name does not exist in the named table's logical/physical column mappings.

Common situations: @JoinColumn or @Column referencing a column name that was never declared on the target table, often due to mismatched naming strategies or typos.


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

Appendix: source

Thrown at hibernate-core/src/main/java/org/hibernate/boot/internal/InFlightMetadataCollectorImpl.java:1213

		Identifier logicalName = null;
		Table currentTable = table;
		while ( currentTable != null ) {
			final TableColumnNameBinding binding = columnNameBindingByTableMap.get( currentTable );
			if ( binding != null ) {
				logicalName = binding.physicalToLogical.get( physicalNameString );
				if ( logicalName != null ) {
					break;
				}
			}
			currentTable =
					currentTable instanceof DenormalizedTable denormalizedTable
							? denormalizedTable.getIncludedTable()
							: null;
		}

		if ( logicalName == null ) {
			assert table != null;
			throw new MappingException( "Unable to find column with physical name '"
					+ physicalNameString + "' in table '" + table.getName() + "'" );
		}

		return logicalName.render();
	}

	@Override
	public void addAuxiliaryDatabaseObject(AuxiliaryDatabaseObject auxiliaryDatabaseObject) {
		getDatabase().addAuxiliaryDatabaseObject( auxiliaryDatabaseObject );
	}

	private final Map<String,AnnotatedClassType> annotatedClassTypeMap = new HashMap<>();

	@Override
	public AnnotatedClassType getClassType(ClassDetails clazz) {
		final var type = annotatedClassTypeMap.get( clazz.getName() );
		return type == null ? addClassType( clazz ) : type;
	}

View on GitHub (pinned to fad1729dce)