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(); }