hibernate/hibernate-orm · error · IllegalArgumentException

Not an entity: ${entityName}

Error message

Not an entity: ${entityName}

What it means

Error "Not an entity: ${entityName}" thrown in hibernate/hibernate-orm.

Source

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

		for ( var entry : managedTypeByName.entrySet() ) {
			if ( entry.getValue() instanceof EntityDomainType<?> possibility ) {
				if ( entityName.equals( possibility.getName() ) ) {
					return possibility;
				}
			}
		}

		return null;
	}

	@Override
	@Nonnull
	public EntityDomainType<?> entity(@Nullable String entityName) {
		final EntityDomainType<?> entityType = findEntityType( entityName );
		if ( entityType == null ) {
			// per JPA, this is an exception
			throw new IllegalArgumentException( "Not an entity: " + entityName );
		}
		return entityType;

	}

	@Override
	@Nullable
	public EmbeddableDomainType<?> findEmbeddableType(@Nullable String embeddableName) {
		if ( embeddableName == null ) {
			return null;
		}
		final var managedType = managedTypeByName.get( embeddableName );
		if ( !( managedType instanceof EmbeddableDomainType<?> embeddableDomainType ) ) {
			return null;
		}
		return embeddableDomainType;
	}

View on GitHub (pinned to fad1729dce)

Solutions

  1. Pass the name of a mapped entity; check spelling and that the class is annotated @Entity.

When it happens

Trigger: Thrown when JpaMetamodel.entity() is called with a type name that is not a mapped entity.

Common situations: See trigger scenarios.


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