//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public org.hibernate.Session currentSession() throws org.hibernate.HibernateException
        public override Session currentSession()
        {
            Session session = (Session)Session.get();

            if (session == null)
            {
                if (this.sharedGroupCodesProvider == null)
                {
                    session = SessionFactory.openSession(this.prjDBInterceptor);
                }
                else
                {
                    try
                    {
                        Connection connection = ProjectSessionFactory.getConnection(this.o_urlTable.Url, this.o_urlTable.Username, this.o_urlTable.Password);
                        session = SessionFactory.openSession(connection, this.prjDBInterceptor);
                    }
                    catch (Exception exception)
                    {
                        throw new HibernateException(exception);
                    }
                }
                Session.set(session);
                this.aliveSessions.Add(session);
            }
            else if (!session.Open)
            {
                closeSession();
                session = null;
                session = currentSession();
            }
            return(session);
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void loadDB() throws Exception
        public override void loadDB()
        {
            if (DBLoaded)
            {
                return;
            }
            if (syncToEventDispatch && !SwingUtilities.EventDispatchThread)
            {
                this.o_retException = null;
                loadDB();
                SwingUtilities.invokeAndWait(new RunnableAnonymousInnerClass(this));
                if (this.o_retException != null)
                {
                    throw this.o_retException;
                }
                return;
            }
            closeSession();
            this.dbmsType = this.o_urlTable.Dbms.Value;
            if (this.requiresAlters)
            {
                this.o_configuration = ProjectSessionFactoryBuilder.Instance.createConfigurationFromUrl(configXML, this.o_urlTable, ProjectGroupCodesProvider, this.requiresAlters, this.o_urlTable.TablePrefix);
                long l = DateTimeHelper.CurrentUnixTimeMillis();
                Console.WriteLine("  BUILDING SESSION FACTORY...");
                this.o_sessionFactory = this.o_configuration.buildSessionFactory();
                Console.WriteLine("DONE IN: " + ((DateTimeHelper.CurrentUnixTimeMillis() - l) / 1000L));
            }
            else
            {
                if (ProjectSessionFactory.GroupCodesProvider == null)
                {
                    ProjectSessionFactory.UpGroupCodesProvider = s_providerFactory.createSharedFactory();
                }
                this.sharedGroupCodesProvider = (ProjectGroupCodesProvider)ProjectSessionFactory.GroupCodesProvider;
                long l = DateTimeHelper.CurrentUnixTimeMillis();
                Console.WriteLine("  GETTING SESSION FACTORY...");
                this.o_configuration  = ProjectSessionFactory.getConfiguration(this.dbmsType);
                this.o_sessionFactory = ProjectSessionFactory.getSessionFactory(this.dbmsType);
                Console.WriteLine("DONE IN: " + ((DateTimeHelper.CurrentUnixTimeMillis() - l) / 1000L));
            }
            currentSession();
            closeSession();
            this.b_isDBLoaded = true;
            ProjectDBUtil projectDBUtil;

            (projectDBUtil = ProjectDBUtil.currentProjectDBUtil()).CurrentProjectDBUtil = this;
            if (this.o_properties == null)
            {
                this.o_properties = new ProjectDBProperties(this, true);
            }
            else
            {
                this.o_properties.reloadProperties();
            }
            if (!string.ReferenceEquals(this.o_properties.PreviousVersion, null) && this.requiresAlters && !(s_providerFactory is nomitech.ces.utils.DummyProjectGroupCodesProviderFactory))
            {
                updateNewerDatabase();
            }
            if (this.sharedGroupCodesProvider == null)
            {
                ProjectGroupCodesProvider.initializeProjectCaches();
            }
            else
            {
                ((WBSCache)Wbs1Cache).initCache();
                ((WBS2Cache)Wbs2Cache).initCache();
                try
                {
                    ((ParamItemCache)ParamItemCache).initializeCache();
                }
                catch (Exception exception)
                {
                    Console.WriteLine(exception.ToString());
                    Console.Write(exception.StackTrace);
                }
            }
            ProjectVariableCache.initCache();
            ProjectDBUtil.CurrentProjectDBUtil = projectDBUtil;
        }