@@ -131,7 +131,7 @@ public byte[] enhance(String className, byte[] originalBytes) throws Enhancement
131131 return byteBuddyState .rewrite ( typePool , safeClassName , byteBuddy -> doEnhance (
132132 () -> byteBuddy .ignore ( isDefaultFinalizer () )
133133 .redefine ( typeDescription , typePool .asClassFileLocator () )
134- . annotateType ( constants . HIBERNATE_VERSION_ANNOTATION ) ,
134+ ,
135135 typeDescription
136136 ) );
137137 }
@@ -193,6 +193,7 @@ private DynamicType.Builder<?> doEnhance(Supplier<DynamicType.Builder<?>> builde
193193
194194 log .debugf ( "Enhancing [%s] as Entity" , managedCtClass .getName () );
195195 DynamicType .Builder <?> builder = builderSupplier .get ();
196+ builder = builder .annotateType ( constants .HIBERNATE_VERSION_ANNOTATION );
196197 builder = builder .implement ( ManagedEntity .class )
197198 .defineMethod ( EnhancerConstants .ENTITY_INSTANCE_GETTER_NAME , constants .TypeObject , constants .methodModifierPUBLIC )
198199 .intercept ( FixedValue .self () );
@@ -358,6 +359,7 @@ else if ( enhancementContext.isCompositeClass( managedCtClass ) ) {
358359 log .debugf ( "Enhancing [%s] as Composite" , managedCtClass .getName () );
359360
360361 DynamicType .Builder <?> builder = builderSupplier .get ();
362+ builder = builder .annotateType ( constants .HIBERNATE_VERSION_ANNOTATION );
361363 builder = builder .implement ( ManagedComposite .class );
362364 builder = addInterceptorHandling ( builder , managedCtClass );
363365
@@ -396,12 +398,14 @@ else if ( enhancementContext.isMappedSuperclassClass( managedCtClass ) ) {
396398 log .debugf ( "Enhancing [%s] as MappedSuperclass" , managedCtClass .getName () );
397399
398400 DynamicType .Builder <?> builder = builderSupplier .get ();
401+ builder = builder .annotateType ( constants .HIBERNATE_VERSION_ANNOTATION );
399402 builder = builder .implement ( ManagedMappedSuperclass .class );
400403 return createTransformer ( managedCtClass ).applyTo ( builder );
401404 }
402405 else if ( enhancementContext .doExtendedEnhancement ( managedCtClass ) ) {
403406 log .debugf ( "Extended enhancement of [%s]" , managedCtClass .getName () );
404- return createTransformer ( managedCtClass ).applyExtended ( builderSupplier .get () );
407+ return createTransformer ( managedCtClass ).applyExtended ( builderSupplier .get () )
408+ .annotateType ( constants .HIBERNATE_VERSION_ANNOTATION );
405409 }
406410 else {
407411 log .debugf ( "Skipping enhancement of [%s]: not entity or composite" , managedCtClass .getName () );
0 commit comments