@@ -108,7 +108,8 @@ protected AbstractMappingContext() {
108
108
this .persistentPropertyPathFactory = new PersistentPropertyPathFactory <>(this );
109
109
110
110
EntityInstantiators instantiators = new EntityInstantiators ();
111
- PersistentPropertyAccessorFactory accessorFactory = NativeDetector .inNativeImage () ? BeanWrapperPropertyAccessorFactory .INSTANCE
111
+ PersistentPropertyAccessorFactory accessorFactory = NativeDetector .inNativeImage ()
112
+ ? BeanWrapperPropertyAccessorFactory .INSTANCE
112
113
: new ClassGeneratingPropertyAccessorFactory ();
113
114
114
115
this .persistentPropertyAccessorFactory = new InstantiationAwarePropertyAccessorFactory (accessorFactory ,
@@ -378,25 +379,21 @@ protected Optional<E> addPersistentEntity(TypeInformation<?> typeInformation) {
378
379
descriptors .put (descriptor .getName (), descriptor );
379
380
}
380
381
381
- try {
382
-
383
- PersistentPropertyCreator persistentPropertyCreator = new PersistentPropertyCreator (entity , descriptors );
384
- ReflectionUtils .doWithFields (type , persistentPropertyCreator , PersistentPropertyFilter .INSTANCE );
385
- persistentPropertyCreator .addPropertiesForRemainingDescriptors ();
382
+ PersistentPropertyCreator persistentPropertyCreator = new PersistentPropertyCreator (entity , descriptors );
383
+ ReflectionUtils .doWithFields (type , persistentPropertyCreator , PersistentPropertyFilter .INSTANCE );
384
+ persistentPropertyCreator .addPropertiesForRemainingDescriptors ();
386
385
387
- entity .verify ();
388
-
389
- if (persistentPropertyAccessorFactory .isSupported (entity )) {
390
- entity .setPersistentPropertyAccessorFactory (persistentPropertyAccessorFactory );
391
- }
386
+ entity .verify ();
392
387
393
- } catch (RuntimeException e ) {
394
- persistentEntities .remove (typeInformation );
395
- throw e ;
388
+ if (persistentPropertyAccessorFactory .isSupported (entity )) {
389
+ entity .setPersistentPropertyAccessorFactory (persistentPropertyAccessorFactory );
396
390
}
397
391
398
392
} catch (BeansException e ) {
399
393
throw new MappingException (e .getMessage (), e );
394
+ } catch (RuntimeException e ) {
395
+ persistentEntities .remove (typeInformation );
396
+ throw e ;
400
397
} finally {
401
398
write .unlock ();
402
399
}
0 commit comments