hibernate/hibernate-orm · error · EntityTypeException

Could not resolve entity name '${entityName}'

Error message

Could not resolve entity name '${entityName}'

What it means

Error "Could not resolve entity name '${entityName}'" thrown in hibernate/hibernate-orm.

Source

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

		}

		if ( loadedClass == null ) {
			loadedClass = resolveRequestedClass( entityName );
			// populate the class cache for boot metamodel imports
			if ( importInfo != null && loadedClass != null ) {
				importInfo.loadedClass = loadedClass;
			}
		}

		return loadedClass == null ? null : resolveEntityReference( loadedClass );
	}

	@Override
	@Nonnull
	public EntityDomainType<?> resolveHqlEntityReference(@Nonnull String entityName) {
		final var hqlEntityReference = getHqlEntityReference( entityName );
		if ( hqlEntityReference == null ) {
			throw new EntityTypeException( "Could not resolve entity name '" + entityName + "'", entityName );
		}
		return hqlEntityReference;
	}

	private static <X> ManagedDomainType<X> checkDomainType(Class<X> cls, @Nullable ManagedDomainType<?> domainType) {
		if ( domainType != null && !Objects.equals( domainType.getJavaType(), cls ) ) {
			throw new IllegalStateException( "Managed type " + domainType
						+ " has a different Java type than requested" );
		}
		else {
			@SuppressWarnings("unchecked") // Safe, we checked it
			final var type = (ManagedDomainType<X>) domainType;
			return type;
		}
	}

	@Override
	@Nullable

View on GitHub (pinned to fad1729dce)

Solutions

  1. Check the entity name (default: unqualified class name, or the name given in @Entity) and correct the lookup string.

When it happens

Trigger: Thrown when an entity name (e.g. from an HQL query or EntityGraph) cannot be resolved to a mapped entity.

Common situations: See trigger scenarios.


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