hibernate/hibernate-orm · error · MappingException

Generator name is cannot be blank

Error message

Generator name is cannot be blank

What it means

Error "Generator name is cannot be blank" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/boot/model/internal/GeneratorBinder.java:132

			MetadataBuildingContext context,
			Map<String, ? extends IdentifierGeneratorDefinition> localGenerators) {

		//generator settings
		final var configuration = initializeGeneratorSettings( identifierValue, generatorName );

		final String generatorStrategy;
		if ( generatorName.isEmpty() ) {
			if ( idMember.hasDirectAnnotationUsage( GeneratedValue.class )
					&& handleDefaultGenerator( identifierValue, context, localGenerators, idMember, configuration ) ) {
				// we found an appropriate a "default" generator (as per JPA 3.2)
				return; // EARLY EXIT
			}
			else {
				generatorStrategy = generatorType;
			}
		}
		else if ( generatorName.isBlank() ) {
			throw new MappingException( "Generator name is cannot be blank" );
		}
		else {
			//we have a named generator
			generatorStrategy = determineStrategy(
					idMember,
					generatorType,
					generatorName,
					context,
					localGenerators,
					configuration
			);
		}

		setGeneratorCreator( identifierValue, configuration, generatorStrategy, context );
	}

	/**
	 * Called if {@link GeneratedValue @GeneratedValue} specified no name.

View on GitHub (pinned to fad1729dce)

Solutions

  1. Provide a non-blank name for the generator.

When it happens

Trigger: An identifier/value generator declaration is inconsistent with the referenced generator or the annotated element.

Common situations: @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.


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