hibernate/hibernate-orm · error · UnknownEntityTypeException

Unknown entity type '{}'

Error message

Unknown entity type '{}'

What it means

Error "Unknown entity type '{}'" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/graph/internal/parse/GraphParser.java:124

						attributeName,
						qualifierName
				);
			}
			return resolvePathQualifier( qualifierName ).getSubGraphCreator();
		}
	}

	private SubGraphImplementor<?> createSubGraph(AttributeNodeImplementor<?, ?, ?> attributeNode, String subTypeName) {

		final var shouldCreateTreatedSubgraph = attributeNode == null && subTypeName != null;

		if ( shouldCreateTreatedSubgraph ) {
			final var currentGraph = graphStack.getCurrent();

			final EntityDomainType entityDomainType = entityNameResolver.resolveEntityName( subTypeName );

			if ( entityDomainType == null ) {
				throw new UnknownEntityTypeException( subTypeName );
			}

			return currentGraph.addTreatedSubgraph(
					entityDomainType
			);

		}


		final var subGraphCreator = graphSourceStack.getCurrent();

		return subGraphCreator.createSubGraph(
				attributeNode,
				subTypeName,
				entityNameResolver
		);

	}

View on GitHub (pinned to fad1729dce)

Solutions

  1. Check the entity name in the graph text for typos and ensure the entity is mapped in this persistence unit.
  2. Use the entity's mapped name (or fully qualified class name) as declared in the metamodel.

When it happens

Trigger: Thrown when Hibernate is asked to work with a class/name that is not a mapped managed type in the current SessionFactory.

Common situations: Typical situations: typos in entity names; the entity class not registered in the persistence unit; using a mapped-superclass or unmapped class where an entity is required.


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