galovics commented on code in PR #2685:
URL: https://github.com/apache/fineract/pull/2685#discussion_r999440371
##########
fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/config/jpa/JPAConfig.java:
##########
@@ -70,29 +77,48 @@ public JPAConfig(RoutingDataSource dataSource,
JpaProperties properties, ObjectP
@DependsOn("tenantDatabaseUpgradeService")
public LocalContainerEntityManagerFactoryBean
entityManagerFactory(EntityManagerFactoryBuilder factoryBuilder) {
Map<String, Object> vendorProperties = getVendorProperties();
- customizeVendorProperties(vendorProperties);
- return
factoryBuilder.dataSource(getDataSource()).properties(vendorProperties).persistenceUnit("jpa-pu")
- .packages("org.apache.fineract").jta(false).build();
+ String[] packagesToScan = getPackagesToScan();
+ return
factoryBuilder.dataSource(getDataSource()).properties(vendorProperties).persistenceUnit("jpa-pu").packages(packagesToScan)
+ .jta(false).build();
+ }
+
+ @Override
+ protected Map<String, Object> getVendorProperties() {
+ Map<String, Object> vendorProperties = new HashMap<>();
+ vendorProperties.put(PersistenceUnitProperties.WEAVING, "static");
+
vendorProperties.put(PersistenceUnitProperties.PERSISTENCE_CONTEXT_CLOSE_ON_COMMIT,
"true");
+ vendorProperties.put(PersistenceUnitProperties.CACHE_SHARED_DEFAULT,
"false");
+ emFactoryCustomizers.forEach(c ->
vendorProperties.putAll(c.additionalVendorProperties()));
Review Comment:
Defaults, might be but I don't want to have a fragmented configuration
codebase for JPA. either everything sits here or in app props.
Plus, these customizers will be used by custom modules/external modules
where the application.properties resolution (in addition to Fineract's) is not
solved. This is similar how Spring expands its configuration capabilities tbh.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]