hibernate/hibernate-orm · error · NotIndexedCollectionException

Plural attribute [{}] is not indexed (list / map)

Error message

Plural attribute [{}] is not indexed (list / map)

What it means

Error "Plural attribute [{}] is not indexed (list / map)" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/PluralPersistentAttribute.java:30

/**
 * Extension of the JPA-defined {@link PluralAttribute} interface.
 *
 * @author Steve Ebersole
 */
public interface PluralPersistentAttribute<D, C, E>
		extends PersistentAttribute<D, C>, PathSource<E>, PluralAttribute<D, C, E> {
	@Override
	@Nonnull
	ManagedDomainType<D> getDeclaringType();

	@Nonnull
	CollectionClassification getCollectionClassification();

	PathSource<E> getElementPathSource();

	default PathSource<?> getIndexPathSource() {
		throw new NotIndexedCollectionException(
				"Plural attribute [" +  getPathName() + "] is not indexed (list / map)"
		);
	}

	@Override
	@Nonnull
	SimpleDomainType<E> getElementType();

	@Override
	@Nonnull
	SimpleDomainType<E> getValueGraphType();

	@Override
	default SimpleDomainType<?> getKeyGraphType() {
		throw new NotIndexedCollectionException(
				"Plural attribute [" +  getPathName() + "] is not indexed (list / map)"
		);
	}

View on GitHub (pinned to fad1729dce)

Solutions

  1. Only call index/key operations on indexed collections (List or Map); change the attribute to List/Map or avoid the index access.

When it happens

Trigger: Thrown when code asks a plural attribute for its index (list/map key) part but the attribute is a non-indexed collection (bag/set).

Common situations: See trigger scenarios.


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