hibernate/hibernate-orm · error · AnnotationException

Multiple constructors of '<className>' are annotated '@Insta

Error message

Multiple constructors of '<className>' are annotated '@Instantiator' but only one constructor can be the canonical constructor

What it means

Error "Multiple constructors of '<className>' are annotated '@Instantiator' but only one constructor can be the canonical constructor" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/boot/model/internal/EmbeddableBinder.java:1114

			) );
		}

		embeddable.setColumnNamingPattern( columnNamingPattern );
	}

	private static ConstructorDetails resolveInstantiator(TypeDetails embeddableClass) {
		return embeddableClass == null ? null : resolveInstantiator( embeddableClass.determineRawClass() );
	}

	private static ConstructorDetails resolveInstantiator(ClassDetails embeddableClass) {
		if ( embeddableClass == null ) {
			return null;
		}
		ConstructorDetails result = null;
		for ( var constructor : embeddableClass.getConstructors() ) {
			if ( constructor.hasDirectAnnotationUsage( Instantiator.class ) ) {
				if ( result != null ) {
					throw new AnnotationException( "Multiple constructors of '" + embeddableClass.getName()
							+ "' are annotated '@Instantiator' but only one constructor can be the canonical constructor" );
				}
				result = constructor;
			}
		}
		return result;
	}

	public static Class<? extends EmbeddableInstantiator> determineCustomInstantiator(
			MemberDetails property,
			ClassDetails returnedClass,
			MetadataBuildingContext context) {
		if ( isEmbeddedId( property ) ) {
			// we don't allow custom instantiators for composite ids
			return null;
		}

		final var propertyAnnotation =

View on GitHub (pinned to fad1729dce)

Solutions

  1. Keep @Instantiator on only one constructor of the class; remove it from the others.

When it happens

Trigger: More than one constructor of an embeddable is annotated @Instantiator.

Common situations: Embeddable record-style mapping where multiple constructors compete to be the canonical instantiator.


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