gov.ornl.mercury3.services

## Class HibernateSessionFactory

- java.lang.Object
- - gov.ornl.mercury3.services.HibernateSessionFactory

-     public class HibernateSessionFactory
      extends Object

  Configures and provides access to Hibernate sessions, tied to the current thread of execution. Follows the Thread Local Session pattern, see `http://hibernate.org/42.html` .

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `closeSession()` Close the single hibernate session instance.
    `static org.hibernate.cfg.Configuration` | `getConfiguration()` return hibernate configuration
    `static org.hibernate.Session` | `getSession()` Returns the ThreadLocal Session instance.
    `static org.hibernate.SessionFactory` | `getSessionFactory()` return session factory
    `static void` | `rebuildSessionFactory()` Rebuild hibernate session factory
    `static void` | `setConfigFile(String configFile)` return session factory session factory will be rebuilded in the next call

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### getSession

          public static org.hibernate.Session getSession()
                                                  throws org.hibernate.HibernateException

      Returns the ThreadLocal Session instance. Lazy initialize the `SessionFactory` if needed.
      Returns:
        Session
      Throws:
        `org.hibernate.HibernateException`

    - #### rebuildSessionFactory

          public static void rebuildSessionFactory()

      Rebuild hibernate session factory

    - #### closeSession

          public static void closeSession()
                                   throws org.hibernate.HibernateException

      Close the single hibernate session instance.
      Throws:
        `org.hibernate.HibernateException`

    - #### getSessionFactory

          public static org.hibernate.SessionFactory getSessionFactory()

      return session factory

    - #### setConfigFile

          public static void setConfigFile(String configFile)

      return session factory session factory will be rebuilded in the next call

    - #### getConfiguration

          public static org.hibernate.cfg.Configuration getConfiguration()

      return hibernate configuration

Copyright © 2016. All rights reserved.