hibernate/hibernate-orm · error · IllegalArgumentException

Unknown managed type

Error message

Unknown managed type: {}

What it means

PathQualifierType.managedType could not resolve the subtype name used in a treated key/value subgraph to any managed type in the metamodel. The offending input is the subtype name token from the graph text.

Solutions

  1. Verify the managed type name in the graph path exists in the metamodel and is spelled correctly.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown when Hibernate is asked to work with a class/name that is not a mapped managed type in the current SessionFactory.

Common situations: Typical situations: typos in entity names; the entity class not registered in the persistence unit; using a mapped-superclass or unmapped class where an entity is required.


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

Appendix: source

Thrown at hibernate-core/src/main/java/org/hibernate/graph/internal/parse/PathQualifierType.java:29

/**
 * @author Steve Ebersole
 */
public enum PathQualifierType {

	KEY( (attributeNode, subtypeName, entityNameResolver) -> subtypeName == null
			? attributeNode.addKeySubgraph()
			: attributeNode.addKeySubgraph().addTreatedSubgraph( managedType( subtypeName, entityNameResolver ) )
	),

	VALUE( (attributeNode, subtypeName, entityNameResolver) -> subtypeName == null
			? attributeNode.addValueSubgraph()
			: attributeNode.addValueSubgraph().addTreatedSubgraph( managedType( subtypeName, entityNameResolver ) )
	);

	private static <T> ManagedDomainType<T> managedType(String subtypeName, GraphParserEntityNameResolver resolver) {
		final var entityDomainType = resolver.resolveEntityName( subtypeName );
		if ( entityDomainType == null ) {
			throw new IllegalArgumentException( "Unknown managed type: " + subtypeName );
		}
		//noinspection unchecked
		return (ManagedDomainType<T>) entityDomainType;
	}

	private final SubGraphGenerator subGraphCreator;

	PathQualifierType(SubGraphGenerator subgraphCreator) {
		this.subGraphCreator = subgraphCreator;
	}

	public SubGraphGenerator getSubGraphCreator() {
		return subGraphCreator;
	}
}

View on GitHub (pinned to fad1729dce)