hibernate/hibernate-orm · error · UnsupportedMappingException

Entity mapping does not support primary TableReference creat

Error message

Entity mapping does not support primary TableReference creation [{className} : {entityName}]

What it means

Error "Entity mapping does not support primary TableReference creation [{className} : {entityName}]" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/metamodel/mapping/EntityMappingType.java:612

			NavigablePath navigablePath,
			String explicitSourceAlias,
			SqlAliasBase explicitSqlAliasBase,
			Supplier<Consumer<Predicate>> additionalPredicateCollectorAccess,
			SqlAstCreationState creationState) {
		return getEntityPersister().createRootTableGroup(
				canUseInnerJoins,
				navigablePath,
				explicitSourceAlias,
				explicitSqlAliasBase,
				additionalPredicateCollectorAccess,
				creationState
		);
	}

	default TableReference createPrimaryTableReference(
			SqlAliasBase sqlAliasBase,
			SqlAstCreationState creationState) {
		throw new UnsupportedMappingException(
				"Entity mapping does not support primary TableReference creation [" +
						getClass().getName() + " : " + getEntityName() + "]"
		);
	}

	default TableReferenceJoin createTableReferenceJoin(
			String joinTableExpression,
			SqlAliasBase sqlAliasBase,
			TableReference lhs,
			SqlAstCreationState creationState) {
		throw new UnsupportedMappingException(
				"Entity mapping does not support primary TableReference join creation [" +
						getClass().getName() + " : " + getEntityName() + "]"
		);
	}

	@Override
	default JavaType<?> getMappedJavaType() {

View on GitHub (pinned to fad1729dce)

Solutions

  1. This is an internal limitation; report it with a reproducer or avoid the query shape (e.g. treat or path) that triggers primary table reference creation on this mapping.

When it happens

Trigger: Thrown when SQL generation requests a primary table reference from an entity mapping type that does not support it (e.g. a non-persister mapping).

Common situations: See trigger scenarios.


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