hibernate/hibernate-orm · error · UnsupportedOperationException

AnyType support has not yet been implemented

Error message

AnyType support has not yet been implemented

What it means

Sentinel UnsupportedOperationException while building singular attribute mappings: the boot property value is an AnyType, whose mapping-model support has not yet been implemented in this code path.

Solutions

  1. Avoid @Any mappings in this context (e.g. inside the affected model part); use a standard many-to-one or inheritance mapping instead.
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown when mapping model creation reaches an AnyType usage in a context where any-type support has not been implemented.

Common situations: See trigger scenarios.


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

Appendix: source

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

					declaringType,
					declaringEntityPersister,
					propertyAccess
			) );

			creationProcess.registerForeignKeyPostInitCallbacks(
					"To-one key - " + navigableRole,
					() -> MappingModelCreationHelper.interpretToOneKeyDescriptor(
							attributeMapping,
							bootProperty,
							(ToOne) bootProperty.getValue(),
							null,
							creationProcess
					)
			);
			return attributeMapping;
		}
		else {
			throw new UnsupportedOperationException( "AnyType support has not yet been implemented" );
		}
	}

	private static FetchTiming fetchTiming(Property bootProperty, ManagedMappingType declaringType, ToOne value, EntityPersister entityPersister, FetchStyle fetchStyle, AssociationType type, SessionFactoryImplementor sessionFactory) {
		final String role = declaringType.getNavigableRole().toString() + "." + bootProperty.getName();
		final boolean lazy = value.isLazy();
		if ( lazy && entityPersister.getBytecodeEnhancementMetadata().isEnhancedForLazyLoading() ) {
			if ( value.isUnwrapProxy() ) {
				return determineFetchTiming( fetchStyle, type, lazy, role, sessionFactory );
			}
			else if ( value instanceof ManyToOne manyToOne && value.isNullable() && manyToOne.isIgnoreNotFound() ) {
				return FetchTiming.IMMEDIATE;
			}
			else {
				return determineFetchTiming( fetchStyle, type, lazy, role, sessionFactory );
			}
		}
		else if ( !lazy

View on GitHub (pinned to fad1729dce)