{"record":{"id":"5a805e16cdfdfe2b","repo":"hibernate/hibernate-orm","slug":"multiple-constructors-of-classname-are-annotat","errorCode":null,"errorMessage":"Multiple constructors of '<className>' are annotated '@Instantiator' but only one constructor can be the canonical constructor","messagePattern":"Multiple constructors of '<className>' are annotated '@Instantiator' but only one constructor can be the canonical constructor","errorType":"exception","errorClass":"AnnotationException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/model/internal/EmbeddableBinder.java","lineNumber":1114,"sourceCode":"\t\t\t) );\n\t\t}\n\n\t\tembeddable.setColumnNamingPattern( columnNamingPattern );\n\t}\n\n\tprivate static ConstructorDetails resolveInstantiator(TypeDetails embeddableClass) {\n\t\treturn embeddableClass == null ? null : resolveInstantiator( embeddableClass.determineRawClass() );\n\t}\n\n\tprivate static ConstructorDetails resolveInstantiator(ClassDetails embeddableClass) {\n\t\tif ( embeddableClass == null ) {\n\t\t\treturn null;\n\t\t}\n\t\tConstructorDetails result = null;\n\t\tfor ( var constructor : embeddableClass.getConstructors() ) {\n\t\t\tif ( constructor.hasDirectAnnotationUsage( Instantiator.class ) ) {\n\t\t\t\tif ( result != null ) {\n\t\t\t\t\tthrow new AnnotationException( \"Multiple constructors of '\" + embeddableClass.getName()\n\t\t\t\t\t\t\t+ \"' are annotated '@Instantiator' but only one constructor can be the canonical constructor\" );\n\t\t\t\t}\n\t\t\t\tresult = constructor;\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic static Class<? extends EmbeddableInstantiator> determineCustomInstantiator(\n\t\t\tMemberDetails property,\n\t\t\tClassDetails returnedClass,\n\t\t\tMetadataBuildingContext context) {\n\t\tif ( isEmbeddedId( property ) ) {\n\t\t\t// we don't allow custom instantiators for composite ids\n\t\t\treturn null;\n\t\t}\n\n\t\tfinal var propertyAnnotation =","sourceCodeStart":1096,"sourceCodeEnd":1132,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/model/internal/EmbeddableBinder.java#L1096-L1132","documentation":"Error \"Multiple constructors of '<className>' are annotated '@Instantiator' but only one constructor can be the canonical constructor\" thrown in hibernate/hibernate-orm.","triggerScenarios":"More than one constructor of an embeddable is annotated @Instantiator.","commonSituations":"Embeddable record-style mapping where multiple constructors compete to be the canonical instantiator.","solutions":["Keep @Instantiator on only one constructor of the class; remove it from the others."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}