hibernate/hibernate-orm · error · UnsupportedOperationException

Not yet implemented

Error message

Not yet implemented

What it means

transferPluralAny unconditionally throws UnsupportedOperationException('Not yet implemented'): Hibernate 6's hbm-to-mapping.xml transformer has no implementation for plural <any/> mappings (<many-to-any>). This is a hard feature gap, not a runtime condition - it fires 100% of the time a many-to-any collection is transformed, and is usually observed wrapped by error 363.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/boot/jaxb/hbm/transform/HbmXmlTransformer.java:3660

		}
		if ( hbmCollection.getSqlDeleteAll() != null ) {
			final var jaxbCustomSql = new JaxbCustomSqlImpl();
			target.setSqlDeleteAll( jaxbCustomSql );
			transferCustomSql( hbmCollection.getSqlDeleteAll(), jaxbCustomSql );
		}
	}

	private JaxbPluralAnyMappingImpl transformPluralAny(PluralAttributeInfo hbmCollection) {
		final var target = new JaxbPluralAnyMappingImpl();
		transferPluralAny( hbmCollection, hbmCollection.getManyToAny(), target );
		return target;
	}

	private void transferPluralAny(
			PluralAttributeInfo hbmCollection,
			JaxbHbmManyToAnyCollectionElementType manyToAny,
			JaxbPluralAnyMappingImpl target) {
		throw new UnsupportedOperationException( "Not yet implemented" );
	}

	private void transferIdentifier(
			JaxbHbmRootEntityType hbmEntity,
			JaxbEntityImpl mappingXmlEntity,
			EntityTypeInfo bootEntityInfo,
			RootClass rootClass) {
		final var identifierProperty = rootClass.getIdentifierProperty();
		if ( identifierProperty != null ) {
			// we have either a simple id or an embedded id
			transferSinglePropertyIdentifier( hbmEntity, mappingXmlEntity, bootEntityInfo, rootClass, identifierProperty );
		}
		else {
			transferNonAggregatedCompositeId( hbmEntity, mappingXmlEntity, bootEntityInfo, rootClass );
		}
	}

	private void transferSinglePropertyIdentifier(

View on GitHub (pinned to fad1729dce)

Solutions

  1. Do not run the transformer over mappings containing <many-to-any>; bind those files natively as hbm.xml
  2. Hand-author the equivalent in mapping.xml for that collection
  3. Remodel: introduce an association entity with an explicit type discriminator column and a normal one-to-many/many-to-many
  4. Track/upvote the Hibernate JIRA issue for plural-any transformation support before relying on it

Example fix

// before
metadataSources.addFile("polymorphic.hbm.xml"); // contains <many-to-any>
transformer.transform(...); // UnsupportedOperationException: Not yet implemented

// after: keep hbm.xml for that unit, transform the rest
metadataSources.addFile("polymorphic.hbm.xml"); // native hbm binding, no transformation
Defensive patterns

Strategy: validation

Validate before calling

// refuse to transform files containing many-to-any - fail fast with a clear message
boolean hasPluralAny = doc.getElementsByTagName("many-to-any").getLength() > 0;
if (hasPluralAny) {
    skipTransformationAndBindNatively(hbmFile); // hbm.xml remains directly bindable
}

Try / catch

try {
    transformer.transform(hbmSource);
} catch (TransformationException e) {
    if (e.getCause() instanceof UnsupportedOperationException
            && e.getCause().getMessage().contains("Not yet implemented")) {
        metadataSources.addFile(hbmPath); // native hbm binding fallback for this unit
    } else { throw e; }
}

Prevention

When it happens

Trigger: Any transformation of a collection whose body is <many-to-any ...> with <meta-value> children. No configuration change avoids it while the element remains.

Common situations: Polymorphic legacy associations (any entity can be referenced via discriminator + id); bulk migration tools hitting the first unsupported construct in an old codebase.

Related errors


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