Test @Jpa properties should override the default integration settings

This commit is contained in:
Andrea Boriero 2022-07-22 10:21:13 +02:00 committed by Andrea Boriero
parent 2d2e7eb4fc
commit d5b408e61d

View File

@ -81,6 +81,10 @@ public static EntityManagerFactoryScope findEntityManagerFactoryScope(
final Jpa emfAnn = emfAnnWrapper.orElseThrow( () -> new RuntimeException( "Could not locate @EntityManagerFactory" ) );
final PersistenceUnitInfoImpl pui = new PersistenceUnitInfoImpl( emfAnn.persistenceUnitName() );
( (Map<Object, Object>) Environment.getProperties() ).forEach(
(key, value) ->
pui.getProperties().put( key, value )
);
pui.setTransactionType( emfAnn.transactionType() );
pui.setCacheMode( emfAnn.sharedCacheMode() );
@ -159,10 +163,7 @@ public static EntityManagerFactoryScope findEntityManagerFactoryScope(
final Map<String, Object> integrationSettings = new HashMap<>();
( (Map<Object, Object>) Environment.getProperties() ).forEach(
(key, value) ->
integrationSettings.put( (String) key, value )
);
integrationSettings.put( GlobalTemporaryTableMutationStrategy.DROP_ID_TABLES, "true" );
integrationSettings.put( LocalTemporaryTableMutationStrategy.DROP_ID_TABLES, "true" );