title: How to connect multiple database with reusing cfg.xml and util class?
body: <p>I want to connect multiple databases like SQL and Oracle with different databases.So i already had MSSQL hibernate.cfg.xml and Hibernateutil class for session factory.Now i'm trying to connect oracle with different table.</p>
  
  <p>Please advise can i use same cgf.xml and util class can configure oracle databases as well.</p>
  
  <p>Here is util class.</p>
  
  <pre><code>public class HibernateUtil {
      private static final SessionFactory sessionFactory = buildSessionFactory();
  
      @SuppressWarnings("deprecation")
      private static SessionFactory buildSessionFactory()
      {
          try
          {
  
              SessionFactory sessionFactory = new Configuration().configure("/DAO/hibernate.cfg.xml").buildSessionFactory();
              return sessionFactory;        
          }
          catch (Throwable ex) {
              System.err.println("Initial SessionFactory creation failed." + ex);
              throw new ExceptionInInitializerError(ex);
          }
      }
  
      public static SessionFactory getSessionFactory() {
          return sessionFactory;
      }
  
      public static void shutdown() {
          // Close caches and connection pools
          getSessionFactory().close();
      }
  
  }
  </code></pre>