hibernate/hibernate-orm · error · InvalidGraphException

Expecting graph text to not include an entity name : ${graph

Error message

Expecting graph text to not include an entity name : ${graph}

What it means

Error "Expecting graph text to not include an entity name : ${graph}" thrown in hibernate/hibernate-orm.

Source

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

		return GraphParsing.visit( graphName, entityDomainType, graphContext.graphElementList(),
				entityName -> resolve( entityName, entityDomainNameResolver ) );
	}


	private <T> RootGraphImplementor<T> parseGraphForLegacyParsingMode(
			GraphParserEntityClassResolver entityDomainClassResolver,
			GraphParserEntityNameResolver entityDomainNameResolver) {

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


		EntityDomainType<T> entityDomainType;

		final var typeIndicator = graphContext.typeIndicator();

		if ( typeIndicator != null ) {
			if ( entityType != null ) {
				throw new InvalidGraphException(
						"Expecting graph text to not include an entity name : " + annotation.graph() );
			}

			DeprecationLogger.DEPRECATION_LOGGER.deprecatedNamedEntityGraphTextThatContainTypeIndicator();

			entityDomainType = (EntityDomainType<T>) resolve( typeIndicator.TYPE_NAME().toString(), entityDomainNameResolver );
		}
		else {
			entityDomainType = resolveEntityDomainTypeFromAnnotation( entityDomainClassResolver );
		}


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

		return GraphParsing.visit( graphName, entityDomainType, graphContext.attributeList(),
				entityName -> resolve( entityName, entityDomainNameResolver ) );
	}

View on GitHub (pinned to fad1729dce)

Solutions

  1. Remove the entity name prefix from the graph text; provide it via the root parameter instead.

When it happens

Trigger: Two managed types are registered under the same entity name.

Common situations: Duplicate @Entity(name=...) values or two classes with the same simple name in one persistence unit.


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