hibernate/hibernate-orm · error · AnnotationException
Property '${property}' is annotated '@Version' but has a 'Ge
Error message
Property '${property}' is annotated '@Version' but has a 'Generator' which does not generate on inserts What it means
Error "Property '${property}' is annotated '@Version' but has a 'Generator' which does not generate on inserts" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/boot/model/internal/GeneratorBinder.java:633
}
catch (Exception e) {
throw new org.hibernate.InstantiationException( "Could not instantiate id generator", generatorClass, e );
}
}
private static <A extends Annotation> void callInitialize(
A annotation,
GeneratorCreationContext creationContext,
Generator generator) {
if ( generator instanceof AnnotationBasedGenerator<?> annotationBasedGenerator ) {
initializeGenerator( annotationBasedGenerator, annotation, creationContext );
}
}
private static void checkVersionGenerationAlways(MemberDetails property, Generator generator) {
if ( isVersion( property ) ) {
if ( !generator.generatesOnInsert() ) {
throw new AnnotationException("Property '" + property.getName()
+ "' is annotated '@Version' but has a 'Generator' which does not generate on inserts"
);
}
if ( !generator.generatesOnUpdate() ) {
throw new AnnotationException("Property '" + property.getName()
+ "' is annotated '@Version' but has a 'Generator' which does not generate on updates"
);
}
}
}
/**
* If the given {@link Generator} also implements {@link Configurable},
* call its {@link Configurable#configure(GeneratorCreationContext, Properties)
* configure()} method.
*/
private static void callConfigure(
GeneratorCreationContext creationContext,View on GitHub (pinned to fad1729dce)
Solutions
- Use a generator that generates on inserts for the @Version property, or remove 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/746da786aad1f8f6.
Report an issue: GitHub.