From aaa6048fe144e3a7d2667148869a3df4b8c5cc90 Mon Sep 17 00:00:00 2001 From: Alejandro Revilla Date: Mon, 9 Sep 2019 14:58:55 -0300 Subject: [PATCH] actually we need per-session dialect --- modules/dbsupport/src/main/java/org/jpos/ee/DB.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 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 a38249ad4e..0335b1b396 100644 --- a/modules/dbsupport/src/main/java/org/jpos/ee/DB.java +++ b/modules/dbsupport/src/main/java/org/jpos/ee/DB.java @@ -147,6 +147,9 @@ public SessionFactory getSessionFactory() { sf = sessionFactories.get(cm); if (sf == null) sessionFactories.put(cm, sf = newSessionFactory()); + if (sf instanceof SessionFactoryImpl) { + dialect = ((SessionFactoryImpl) sf).getJdbcServices().getDialect(); + } } catch (IOException | ConfigurationException | DocumentException | InterruptedException e) { throw new RuntimeException("Could not configure session factory", e); } finally { @@ -167,11 +170,7 @@ private SessionFactory newSessionFactory() throws IOException, ConfigurationExce Metadata md = getMetadata(); try { newSessionSem.acquireUninterruptibly(); - SessionFactory sf = md.buildSessionFactory(); - if (sf instanceof SessionFactoryImpl) { - dialect = ((SessionFactoryImpl) sf).getJdbcServices().getDialect(); - } - return sf; + return md.buildSessionFactory(); } finally { newSessionSem.release(); }