hibernate/hibernate-orm · error · AnnotationException

Identifier attribute '%s' is annotated '%s' which is not an

Error message

Identifier attribute '%s' is annotated '%s' which is not an '@IdGeneratorType'

What it means

Error "Identifier attribute '%s' is annotated '%s' which is not an '@IdGeneratorType'" thrown in hibernate/hibernate-orm.

Source

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

		if ( idGeneratorAnnotations.size() + generatorAnnotations.size() > 1 ) {
			throw new AnnotationException( String.format(
					Locale.ROOT,
					"Identifier attribute '%s' has too many generator annotations: %s",
					getPath( propertyHolder, inferredData ),
					combineUntyped( idGeneratorAnnotations, generatorAnnotations )
			) );
		}
		if ( !idGeneratorAnnotations.isEmpty() ) {
			idValue.setCustomIdGeneratorCreator( identifierGeneratorCreator(
					idMemberDetails,
					idGeneratorAnnotations.get(0),
					idValue,
					beanContainer( buildingContext )
			) );
		}
		else if ( !generatorAnnotations.isEmpty() ) {
//			idValue.setCustomGeneratorCreator( generatorCreator( idMemberDetails, generatorAnnotation ) );
			throw new AnnotationException( String.format(
					Locale.ROOT,
					"Identifier attribute '%s' is annotated '%s' which is not an '@IdGeneratorType'",
					getPath( propertyHolder, inferredData ),
					generatorAnnotations.get(0).annotationType().getName()
			) );
		}
		else if ( idMemberDetails.hasDirectAnnotationUsage( GeneratedValue.class ) ) {
			createIdGenerator( idMemberDetails, idValue, propertyHolder.getPersistentClass(), buildingContext );
		}
	}

	/**
	 * Returns the value generation strategy for the given property, if any, by
	 * considering {@linkplain ValueGenerationType generator type annotations}.
	 */
	static GeneratorCreator createValueGeneratorFromAnnotations(
			PropertyHolder holder, String propertyName,
			Value value, MemberDetails property, MetadataBuildingContext buildingContext) {

View on GitHub (pinned to fad1729dce)

Solutions

  1. Replace the annotation with one meta-annotated with @IdGeneratorType, or remove it.

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/952fd00819c79c99. Report an issue: GitHub.