{"record":{"id":"2b47fab0c357fca0","repo":"hibernate/hibernate-orm","slug":"generator-name-is-cannot-be-blank","errorCode":null,"errorMessage":"Generator name is cannot be blank","messagePattern":"Generator name is cannot be blank","errorType":"exception","errorClass":"MappingException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/model/internal/GeneratorBinder.java","lineNumber":132,"sourceCode":"\t\t\tMetadataBuildingContext context,\n\t\t\tMap<String, ? extends IdentifierGeneratorDefinition> localGenerators) {\n\n\t\t//generator settings\n\t\tfinal var configuration = initializeGeneratorSettings( identifierValue, generatorName );\n\n\t\tfinal String generatorStrategy;\n\t\tif ( generatorName.isEmpty() ) {\n\t\t\tif ( idMember.hasDirectAnnotationUsage( GeneratedValue.class )\n\t\t\t\t\t&& handleDefaultGenerator( identifierValue, context, localGenerators, idMember, configuration ) ) {\n\t\t\t\t// we found an appropriate a \"default\" generator (as per JPA 3.2)\n\t\t\t\treturn; // EARLY EXIT\n\t\t\t}\n\t\t\telse {\n\t\t\t\tgeneratorStrategy = generatorType;\n\t\t\t}\n\t\t}\n\t\telse if ( generatorName.isBlank() ) {\n\t\t\tthrow new MappingException( \"Generator name is cannot be blank\" );\n\t\t}\n\t\telse {\n\t\t\t//we have a named generator\n\t\t\tgeneratorStrategy = determineStrategy(\n\t\t\t\t\tidMember,\n\t\t\t\t\tgeneratorType,\n\t\t\t\t\tgeneratorName,\n\t\t\t\t\tcontext,\n\t\t\t\t\tlocalGenerators,\n\t\t\t\t\tconfiguration\n\t\t\t);\n\t\t}\n\n\t\tsetGeneratorCreator( identifierValue, configuration, generatorStrategy, context );\n\t}\n\n\t/**\n\t * Called if {@link GeneratedValue @GeneratedValue} specified no name.","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/model/internal/GeneratorBinder.java#L114-L150","documentation":"Error \"Generator name is cannot be blank\" 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":["Provide a non-blank name for the generator."],"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"}