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 updates What it means
Error "Property '${property}' is annotated '@Version' but has a 'Generator' which does not generate on updates" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/boot/model/internal/GeneratorBinder.java:638
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,
Generator generator,
Map<String, Object> configuration,
Value value) {
if ( generator instanceof Configurable configurable ) {
final var parameters = collectParameters(View on GitHub (pinned to fad1729dce)
Solutions
- Use a generator that generates on updates 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/5ed82cf5923dbbf3.
Report an issue: GitHub.