hibernate/hibernate-orm · error · UnknownEntityTypeException

Unknown entity type '${entityName}'

Error message

Unknown entity type '${entityName}'

What it means

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

Source

Thrown at hibernate-core/src/main/java/org/hibernate/boot/model/internal/NamedGraphCreatorParsed.java:74

				GraphParserSettings.GRAPH_PARSER_MODE,
				GraphParserMode::interpret,
				GraphParserMode.LEGACY
		);

		if ( graphParserMode != null && graphParserMode.equals( GraphParserMode.MODERN ) ) {
			return parseGraph( entityDomainClassResolver, entityDomainNameResolver );
		}

		return parseGraphForLegacyParsingMode( entityDomainClassResolver, entityDomainNameResolver );
	}

	private static @Nonnull EntityDomainType<?> resolve(
			String entityName, GraphParserEntityNameResolver entityDomainNameResolver) {
		final var entityDomainType =
				(EntityDomainType<?>)
						entityDomainNameResolver.resolveEntityName( entityName );
		if ( entityDomainType == null ) {
			throw new UnknownEntityTypeException( entityName );
		}
		else {
			return entityDomainType;
		}
	}

	private <T> RootGraphImplementor<T> parseGraph(
			GraphParserEntityClassResolver entityDomainClassResolver,
			GraphParserEntityNameResolver entityDomainNameResolver) {
		final EntityDomainType<T> entityDomainType = resolveEntityDomainTypeFromAnnotation(
				entityDomainClassResolver
		);

		final var graphContext = parseText( annotation.graph() );

		final String graphName = this.name == null ? entityDomainType.getName() : this.name;

		return GraphParsing.visit( graphName, entityDomainType, graphContext.graphElementList(),

View on GitHub (pinned to fad1729dce)

Solutions

  1. Correct the entity type name to one registered in the persistence unit.

When it happens

Trigger: An association or reference targets a type that Hibernate has not mapped as an entity.

Common situations: Missing @Entity on the target class, the class not being scanned into the persistence unit, or a typo in the entity name.


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