{"record":{"id":"af68b8f2f624fee1","repo":"hibernate/hibernate-orm","slug":"classname-does-not-implement-generator","errorCode":null,"errorMessage":"${className} does not implement 'Generator'","messagePattern":"(.+?) does not implement 'Generator'","errorType":"exception","errorClass":"MappingException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/model/internal/GeneratorStrategies.java","lineNumber":111,"sourceCode":"\t\t\t\treturn ForeignGenerator.class;\n\t\t\tcase \"uuid\":\n\t\t\tcase \"uuid.hex\":\n\t\t\t\treturn UUIDHexGenerator.class;\n\t\t\tcase \"uuid2\":\n\t\t\t\treturn UUIDGenerator.class;\n\t\t\tcase \"select\":\n\t\t\t\treturn SelectGenerator.class;\n\t\t\tcase \"guid\":\n\t\t\t\treturn GUIDGenerator.class;\n\t\t}\n\t\tfinal Class<? extends Generator> clazz =\n\t\t\t\tidValue.getBuildingContext().getBootstrapContext()\n\t\t\t\t\t\t.getClassLoaderService()\n\t\t\t\t\t\t.classForName( strategy );\n\t\tif ( !Generator.class.isAssignableFrom( clazz ) ) {\n\t\t\t// in principle, this shouldn't happen, since @GenericGenerator\n\t\t\t// constrains the type to subtypes of Generator\n\t\t\tthrow new MappingException( clazz.getName() + \" does not implement 'Generator'\" );\n\t\t}\n\t\treturn clazz;\n\t}\n\n\tpublic static Class<? extends Generator> mapLegacyNamedGenerator(String strategy, Dialect dialect) {\n\t\tif ( \"native\".equals(strategy) ) {\n\t\t\tstrategy = dialect.getNativeIdentifierGeneratorStrategy();\n\t\t}\n\t\tswitch (strategy) {\n\t\t\tcase \"assigned\":\n\t\t\t\treturn org.hibernate.id.Assigned.class;\n\t\t\tcase \"enhanced-sequence\":\n\t\t\tcase \"sequence\":\n\t\t\t\treturn SequenceStyleGenerator.class;\n\t\t\tcase \"enhanced-table\":\n\t\t\tcase \"table\":\n\t\t\t\treturn org.hibernate.id.enhanced.TableGenerator.class;\n\t\t\tcase \"identity\":","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/model/internal/GeneratorStrategies.java#L93-L129","documentation":"Error \"${className} does not implement 'Generator'\" thrown in hibernate/hibernate-orm.","triggerScenarios":"An identifier/value generator declaration is inconsistent with the referenced generator or the annotated element.","commonSituations":"@GeneratedValue pointing at a generator of the wrong kind (SEQUENCE vs TABLE), a missing named generator, too many generator annotations, or an unsupported generation strategy for @CollectionId.","solutions":["Make the referenced class implement the Generator interface."],"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"}