hibernate/hibernate-orm · error · IllegalArgumentException

No EntityGraph with given name '{}'

Error message

No EntityGraph with given name '{}'

What it means

Error "No EntityGraph with given name '{}'" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/internal/AbstractSharedSessionContract.java:2475

		final var entityGraph = createEntityGraph( graphName );
		return entityGraph == null ? null : castEntityGraph( rootType, graphName, entityGraph );
	}

	@Override @Deprecated
	@Nullable
	public RootGraphImplementor<?> createEntityGraph(@Nonnull String graphName) {
		checkOpen();
		final var named = getFactory().findEntityGraphByName( graphName );
		return named == null ? null : named.makeCopy( true );
	}

	@Override
	@Nonnull
	public RootGraphImplementor<?> getEntityGraph(@Nonnull String graphName) {
		checkOpen();
		final var named = getFactory().findEntityGraphByName( graphName );
		if ( named == null ) {
			throw new IllegalArgumentException( "No EntityGraph with given name '" + graphName + "'" );
		}
		//TODO: we're using the deprecated operation
		//      here to preserve the graph name
		return named.makeCopy(true, graphName );
	}

	@Override
	@Nonnull
	public <T> List<EntityGraph<? super T>> getEntityGraphs(@Nonnull Class<T> entityClass) {
		checkOpen();
		return getFactory().findEntityGraphsByType( entityClass );
	}

	@Override
	@Nonnull
	public ExceptionConverter getExceptionConverter() {
		if ( exceptionConverter == null ) {
			exceptionConverter = new ExceptionConverterImpl( this );

View on GitHub (pinned to fad1729dce)

Solutions

  1. Define the named EntityGraph via @NamedEntityGraph or add it programmatically before use.
  2. Check the graph name for typos.

When it happens

Trigger: Thrown when looking up a named EntityGraph that is not defined for the persistence unit.

Common situations: Typical situations: misspelled graph name; missing @NamedEntityGraph on the entity; using a graph defined for a different entity.


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