hibernate/hibernate-orm · error · IllegalStateException

Unexpected table group type for OneToManyCollectionPart: %s

Error message

Unexpected table group type for OneToManyCollectionPart: %s

What it means

Error "Unexpected table group type for OneToManyCollectionPart: %s" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/OneToManyCollectionPart.java:211

					navigablePath,
					fetched,
					addsPredicate,
					creationState
			);
		}
		else if ( lhs instanceof OneToManyTableGroup otmTableGroup ) {
			final var elementTableGroup = otmTableGroup.getElementTableGroup();
			final var tableGroupJoin = new TableGroupJoin( navigablePath, joinType, elementTableGroup );
			return withMapKeyJoin( tableGroupJoin,
					elementTableGroup,
					navigablePath,
					fetched,
					addsPredicate,
					creationState
			);
		}
		else {
			throw new IllegalStateException(
					"Unexpected table group type for OneToManyCollectionPart: " + lhs.getClass().getName()
			);
		}
	}

	private TableGroupJoin withMapKeyJoin(
			TableGroupJoin tableGroupJoin,
			TableGroup elementTableGroup,
			NavigablePath navigablePath,
			boolean fetched,
			boolean addsPredicate,
			SqlAstCreationState creationState) {
		if ( mapKeyPropertyName != null ) {
			final var elementPart =
					(EntityCollectionPart)
							getCollectionDescriptor().getAttributeMapping()
									.getElementDescriptor();
			if ( elementPart.getAssociatedEntityMappingType().findAttributeMapping( mapKeyPropertyName )

View on GitHub (pinned to fad1729dce)

Solutions

  1. This indicates an internal mismatch; simplify the query (avoid the exotic fetch/join shape) or report it to Hibernate with a reproducer.

When it happens

Trigger: Thrown when a one-to-many collection part is resolved against a table group of an unexpected type during SQL generation.

Common situations: See trigger scenarios.


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