hibernate/hibernate-orm · error · MappingException

Unexpected CollectionClassification : %s

Error message

Unexpected CollectionClassification : %s

What it means

Error "Unexpected CollectionClassification : %s" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/MappingModelCreationHelper.java:607

				break;
			}
			case SET:
			case ORDERED_SET:
			case SORTED_SET: {
				final var setJavaType =
						collectionSemantics.getCollectionClassification() == CollectionClassification.SORTED_MAP
								? SortedSet.class
								: java.util.Set.class;
				collectionMappingType = new CollectionMappingTypeImpl<>(
						jtdRegistry.getDescriptor( setJavaType ),
						collectionSemantics
				);

				indexDescriptor = null;
				break;
			}
			default: {
				throw new MappingException(
						"Unexpected CollectionClassification : " + collectionSemantics.getCollectionClassification()
				);
			}
		}

		final var attributeMetadata = new SimpleAttributeMetadata(
				propertyAccess,
				ImmutableMutabilityPlan.instance(),
				bootProperty.isOptional(),
				bootProperty.isInsertable(),
				bootProperty.isUpdatable(),
				bootProperty.isOptimisticLocked(),
				bootProperty.isSelectable(),
				cascadeStyle
		);

		final var sessionFactory = creationContext.getSessionFactory();
		final var collectionType = collectionDescriptor.getCollectionType();

View on GitHub (pinned to fad1729dce)

Solutions

  1. Use a supported collection classification (BAG, ID_BAG, LIST, SET, MAP, ARRAY) for the collection mapping.

When it happens

Trigger: Thrown when mapping model creation encounters a CollectionClassification enum value it does not handle.

Common situations: See trigger scenarios.


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