com.zphinx.spine.data.impl
Class HibernateSessionFactory

java.lang.Object
  extended by com.zphinx.spine.data.impl.HibernateSessionFactory

 class HibernateSessionFactory
extends Object

Configures and provides access to Hibernate sessions, tied to the current thread of execution. Follows the Thread Local Session pattern.


Method Summary
static void closeSession()
          Close the single hibernate session instance.
 org.hibernate.Session currentSession()
          Returns the ThreadLocal Session instance.
 org.hibernate.cfg.Configuration getConfiguration()
          return hibernate configuration
static HibernateSessionFactory getInstance()
          Creates and returns the only instance of this object
 org.hibernate.SessionFactory getSessionFactory()
          return session factory
 void rebuildSessionFactory()
          Rebuild hibernate session factory
 void setConfigFile(String configFile)
          Sets the configuration file 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

currentSession

public org.hibernate.Session currentSession()
                                     throws org.hibernate.HibernateException
Returns the ThreadLocal Session instance. Lazy initialize the SessionFactory if needed.

Returns:
Session
Throws:
org.hibernate.HibernateException

rebuildSessionFactory

public 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

getInstance

public static HibernateSessionFactory getInstance()
Creates and returns the only instance of this object

Returns:
The only instance of this object

getSessionFactory

public org.hibernate.SessionFactory getSessionFactory()
return session factory


setConfigFile

public void setConfigFile(String configFile)
Sets the configuration file session factory will be rebuilded in the next call


getConfiguration

public org.hibernate.cfg.Configuration getConfiguration()
return hibernate configuration