{"record":{"id":"32cd7af1315605b0","repo":"hibernate/hibernate-orm","slug":"annotation-s-is-not-assignable-to-s","errorCode":null,"errorMessage":"Annotation '%s' is not assignable to '%s'","messagePattern":"Annotation '(.+?)' is not assignable to '(.+?)'","errorType":"exception","errorClass":"AnnotationException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/model/internal/GeneratorAnnotationHelper.java","lineNumber":340,"sourceCode":"\t\t}\n\t\tconfigurable.configure( creationContext, properties );\n\t}\n\n\tpublic static <A extends Annotation> void initializeGenerator(\n\t\t\tAnnotationBasedGenerator<A> generator,\n\t\t\tAnnotation annotation,\n\t\t\tGeneratorCreationContext creationContext) {\n\t\tgenerator.initialize( castAnnotationType( annotation, generator), creationContext );\n\t}\n\n\tprivate static <A extends Annotation> A castAnnotationType(\n\t\t\tAnnotation typeAnnotation,\n\t\t\tAnnotationBasedGenerator<A> annotationBased) {\n\t\tfinal var annotationType = annotationBased.getClass();\n\t\tType[] typeArguments = GenericsHelper.typeArguments( AnnotationBasedGenerator.class, annotationType );\n\t\tif ( typeArguments.length > 0 && typeArguments[0] instanceof Class<?> annotationClass ) {\n\t\t\tif ( !annotationClass.isInstance( typeAnnotation ) ) {\n\t\t\t\tthrow new AnnotationException( String.format( \"Annotation '%s' is not assignable to '%s'\",\n\t\t\t\t\t\tannotationType.getName(), annotationClass.getName() ) );\n\t\t\t}\n\t\t\t@SuppressWarnings(\"unchecked\") // safe, we just checked it\n\t\t\tfinal var castAnnotation = (A) typeAnnotation;\n\t\t\treturn castAnnotation;\n\t\t}\n\t\tthrow new AssertionFailure( \"Could not find implementing interface\" );\n\t}\n\n\tpublic static void handleUuidStrategy(\n\t\t\tSimpleValue idValue,\n\t\t\tMemberDetails idMember,\n\t\t\tClassDetails entityClass,\n\t\t\tMetadataBuildingContext context) {\n\t\tfinal var generatorConfig = findLocalizedMatch(\n\t\t\t\tHibernateAnnotations.UUID_GENERATOR,\n\t\t\t\tidMember,\n\t\t\t\tentityClass,","sourceCodeStart":322,"sourceCodeEnd":358,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/model/internal/GeneratorAnnotationHelper.java#L322-L358","documentation":"Error \"Annotation '%s' is not assignable to '%s'\" thrown in hibernate/hibernate-orm.","triggerScenarios":"A generator-related annotation is not assignable to the expected annotation type.","commonSituations":"Custom generator meta-annotations wired to an incompatible annotation type.","solutions":["Use an annotation type assignable to the expected generator annotation type."],"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"}