You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
allow overriding of persistence properties with system properties #111
Prior to this change, the only way to change the persistence settings
was to edit the persistence.xml. In case of a pre-build .jar, the persistence.xml has to be contained in the .jar with the persistence
module [1], and can not be overridden. However, the current repo
hard-codes the DB connection details in the persistence.xml, which
makes it impossible to override the DB connection details for a fully
built .jar without changing that .jar file.
This change enable the overriding of the properties used for the JPA EntityManagerFactory with system properties, so that DB connection
details can be altered without changing the .jar file.
diff --git a/app/jpa/manager/impl/HibernateManager.java b/app/jpa/manager/impl/HibernateManager.java
index 793d29c..bf8df83 100644
--- a/app/jpa/manager/impl/HibernateManager.java+++ b/app/jpa/manager/impl/HibernateManager.java@@ -38,7 +38,8 @@ public class HibernateManager implements JPAManager {
private final EntityManagerFactory entityManagerFactory;
public HibernateManager() {
- entityManagerFactory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME);+ entityManagerFactory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME,+ System.getProperties());
}
@Override
Activity