From 779d1f1a75da30fc236e4996b4f492c2a163c678 Mon Sep 17 00:00:00 2001 From: Sumeet Phadnis Date: Wed, 2 Aug 2023 15:03:44 +0530 Subject: [PATCH] Set DB user and password read from Space in Properties This way other modules like Flyway that read these properties can find them. Without this, Flyway does not work if DB user and password are set using DBInstantiator. --- modules/dbsupport/src/main/java/org/jpos/ee/DB.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/dbsupport/src/main/java/org/jpos/ee/DB.java b/modules/dbsupport/src/main/java/org/jpos/ee/DB.java index 8d70e96edf..0d8f66844d 100644 --- a/modules/dbsupport/src/main/java/org/jpos/ee/DB.java +++ b/modules/dbsupport/src/main/java/org/jpos/ee/DB.java @@ -569,10 +569,14 @@ private Metadata getMetadata() throws IOException, ConfigurationException, Docum Space sp = SpaceFactory.getSpace("tspace:dbconfig"); String user = (String) sp.inp(dbPropertiesPrefix +"connection.username"); String pass = (String) sp.inp(dbPropertiesPrefix +"connection.password"); - if (user != null) + if (user != null) { ssrb.applySetting("hibernate.connection.username", user); - if (pass != null) + dbProps.setProperty("hibernate.connection.username", user); + } + if (pass != null) { ssrb.applySetting("hibernate.connection.password", pass); + dbProps.setProperty("hibernate.connection.password", pass); + } } MetadataSources mds = new MetadataSources(ssrb.build());