de.nava.informa.impl.hibernate
Class SessionHandler

java.lang.Object
  extended by de.nava.informa.impl.hibernate.SessionHandler

public class SessionHandler
extends Object

Singleton class from which hibernate sesssions may be retrieved needed for transactions.

Author:
Niko Schmuck

Method Summary
 Connection getConnection()
          Gets the default JDBC Connection object.
static SessionHandler getInstance()
          Returns the singelton instance, calling getInstance(Properties) with properties set to null.
static SessionHandler getInstance(Properties props)
          Returns the one and only instance which can be used to obtain a Session for further operation with the hibernate objects.
 Session getSession()
          Gets hibernate session object, if JDBC Connection was set earlier this will be used for the opening a hibernate session.
 Session getSession(Connection conn)
          Gets a a new session whilst using an existing JDBC connection.
 boolean isSessionOpen()
          Returns true if session is open.
 void setConnection(Connection connection)
          Sets the default JDBC Connection object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static SessionHandler getInstance(Properties props)
                                  throws HibernateException
Returns the one and only instance which can be used to obtain a Session for further operation with the hibernate objects.

Throws:
HibernateException - In case a problem occurred while configuring hibernate or creating the session factory.

getInstance

public static SessionHandler getInstance()
                                  throws HibernateException
Returns the singelton instance, calling getInstance(Properties) with properties set to null.

Throws:
HibernateException

getSession

public Session getSession()
                   throws HibernateException
Gets hibernate session object, if JDBC Connection was set earlier this will be used for the opening a hibernate session.

Throws:
HibernateException

getSession

public Session getSession(Connection conn)
Gets a a new session whilst using an existing JDBC connection.

Parameters:
conn - JDBC connection

getConnection

public Connection getConnection()
Gets the default JDBC Connection object.


setConnection

public void setConnection(Connection connection)
Sets the default JDBC Connection object.


isSessionOpen

public boolean isSessionOpen()
Returns true if session is open.



Copyright © 2002-2007 Niko Schmuck. All Rights Reserved.