* to make sure, even though right now, db access is used in the
           * single thread when starting up olat, and therefore the sync would
           * not be necessary
           */
          if (sessionFactory == null) {
            Configuration cfg = DatabaseSetup.datastoreConfiguration();
            // let all extensions add hibernate configuration, if needed
            ExtManager extm = null;
            try {
              extm = ExtManager.getInstance();
            } catch (Exception e) {
              throw new OLATRuntimeException(this.getClass(), "Can not load extensions. Check xml files.", e);
            }
            Class extensionPoint = this.getClass();
            int cnt = extm.getExtensionCnt();
            for (int i = 0; i < cnt; i++) {
              Extension anExt = extm.getExtension(i);
              HibernateConfigurator hibconfigure = (HibernateConfigurator) anExt.getExtensionFor(extensionPoint.getName());
              if (hibconfigure != null) {
                hibconfigure.extend(cfg);
                extm.inform(extensionPoint, anExt, "added hibernate configuration");
              }
            }
            // set audit interceptor that traces lastChanged
            cfg.setInterceptor(new AuditInterceptor());
            cfg.setProperties(getConnectionProperties());
            sessionFactory = cfg.buildSessionFactory();
            registerStatisticsServiceAsMBean(sessionFactory);
            try {
              String lev = "n/a";
              session = sessionFactory.openSession();
              int iso = session.connection().getTransactionIsolation();