hibernate/hibernate-orm · error · UnsupportedMappingException

AttributeContainer [${className}] does not support natural i

Error message

AttributeContainer [${className}] does not support natural ids

What it means

Error "AttributeContainer [${className}] does not support natural ids" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/AttributeContainer.java:63

		/**
		 * todo (6.0) : we still need to implement this properly and the contract may change
		 * 		- specifically I am not certain we will be able to re-use `SingularPersistentAttribute`
		 * 		because of its dependence on declaring-type, etc that we may not be able to do
		 */
		default void applyIdClassAttributes(Set<SingularPersistentAttribute<? super J, ?>> idClassAttributes) {
			throw new UnsupportedMappingException(
					"AttributeContainer [" + getClass().getName() + "] does not support identifiers"
			);
		}

		default void applyVersionAttribute(SingularPersistentAttribute<J, ?> versionAttribute) {
			throw new UnsupportedMappingException(
					"AttributeContainer [" + getClass().getName() + "] does not support versions"
			);
		}

		default void applyNaturalIdAttribute(PersistentAttribute<J, ?> versionAttribute) {
			throw new UnsupportedMappingException(
					"AttributeContainer [" + getClass().getName() + "] does not support natural ids"
			);
		}

		default void addConcreteGenericAttribute(PersistentAttribute<J, ?> idAttribute) {
			throw new UnsupportedMappingException(
					"AttributeContainer [" + getClass().getName() + "] does not generic embeddables"
			);
		}

		/**
		 * Called when configuration of the type is complete
		 */
		void finishUp();
	}
}

View on GitHub (pinned to fad1729dce)

Solutions

  1. Natural-id access requires an entity; adjust the code to use the entity type, not this container.

When it happens

Trigger: Thrown when natural-id access is requested from an attribute container that does not support natural ids.

Common situations: See trigger scenarios.


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