hibernate/hibernate-orm · error · IllegalArgumentException

Not an entity: ${clsName}

Error message

Not an entity: ${clsName}

What it means

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

Source

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

		}
		return type;
	}

	@Override
	@Nullable
	public <X> EntityDomainType<X> findEntityType(Class<X> cls) {
		return checkDomainType( cls, managedTypeByClass.get( cls ) )
					instanceof EntityDomainType<X> entityDomainType
				? entityDomainType
				: null;
	}

	@Override
	@Nonnull
	public <X> EntityDomainType<X> entity(@Nonnull Class<X> cls) {
		final var entityType = findEntityType( cls );
		if ( entityType == null ) {
			throw new IllegalArgumentException( "Not an entity: " + cls.getName() );
		}
		return entityType;
	}

	@Override
	public @Nullable <X> EmbeddableDomainType<X> findEmbeddableType(Class<X> cls) {
		return checkDomainType( cls, managedTypeByClass.get( cls ) )
					instanceof EmbeddableDomainType<X> embeddableDomainType
				? embeddableDomainType
				: null;
	}

	@Override
	@Nonnull
	public <X> EmbeddableDomainType<X> embeddable(@Nonnull Class<X> cls) {
		final var embeddableType = findEmbeddableType( cls );
		if ( embeddableType == null ) {
			throw new IllegalArgumentException( "Not an embeddable: " + cls.getName() );

View on GitHub (pinned to fad1729dce)

Solutions

  1. Pass an @Entity class; verify the class is mapped in this persistence unit.

When it happens

Trigger: Thrown when entity() is called with a Class that is not a mapped entity class.

Common situations: See trigger scenarios.


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