uk.ac.soton.itinnovation.grid.utils
Class SingletonSessionFactory

java.lang.Object
  extended by uk.ac.soton.itinnovation.grid.utils.SingletonSessionFactory

public class SingletonSessionFactory
extends Object


Constructor Summary
SingletonSessionFactory()
           
 
Method Summary
static void checkNoSessionForCurrentThread(String reason)
          Debugging check.
static void close()
           
static void closeThreadLocalSession()
           
static org.hibernate.SessionFactory getFactory()
           
static String[] getOpenSessions()
           
static org.hibernate.classic.Session openThreadLocalSession()
          Create a new session.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SingletonSessionFactory

public SingletonSessionFactory()
Method Detail

openThreadLocalSession

public static org.hibernate.classic.Session openThreadLocalSession()
Create a new session. A new session is created and stored as a ThreadLocal on the singleton factory. It can be fetched using factory.getCurrentSession(), and is also returned directly from this method. You must call closeThreadLocalSession() when done. If a session is already open, an error is logged and the old session is closed first.


closeThreadLocalSession

public static void closeThreadLocalSession()

getFactory

public static org.hibernate.SessionFactory getFactory()

close

public static void close()

getOpenSessions

public static String[] getOpenSessions()

checkNoSessionForCurrentThread

public static void checkNoSessionForCurrentThread(String reason)
Debugging check. Only useful when the system property debug.sessions is set.

Parameters:
reason - if a session is only, throw this error message


Copyright © 2001-2007 University of Southampton IT Innovation Centre. All Rights Reserved.