org.nanocontainer.persistence.hibernate
Class FailoverSessionDelegator

java.lang.Object
  extended by org.nanocontainer.persistence.hibernate.SessionDelegator
      extended by org.nanocontainer.persistence.hibernate.FailoverSessionDelegator
All Implemented Interfaces:
Serializable, org.hibernate.Session

public class FailoverSessionDelegator
extends SessionDelegator

Session delegator with failover behaviour in case of hibernate exception. Old session is disposed and new one is obtained transparently. Session creation is done lazily.

Version:
$Revision: 2043 $
Author:
Jose Peleteiro
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.nanocontainer.persistence.hibernate.SessionDelegator
hibernateExceptionHandler
 
Constructor Summary
FailoverSessionDelegator(org.hibernate.SessionFactory sessionFactory)
           
FailoverSessionDelegator(org.hibernate.SessionFactory sessionFactory, ExceptionHandler exceptionHandler)
           
FailoverSessionDelegator(org.hibernate.SessionFactory sessionFactory, org.hibernate.Interceptor interceptor)
           
FailoverSessionDelegator(org.hibernate.SessionFactory sessionFactory, org.hibernate.Interceptor interceptor, ExceptionHandler exceptionHandler)
           
 
Method Summary
 Connection close()
           
 org.hibernate.Session getDelegatedSession()
          Obtain hibernate session in lazy way.
 org.hibernate.Interceptor getInterceptor()
           
 org.hibernate.SessionFactory getSessionFactory()
           
 void invalidateDelegatedSession()
          Perform actions to dispose "burned" session properly.
 void setInterceptor(org.hibernate.Interceptor interceptor)
           
 
Methods inherited from class org.nanocontainer.persistence.hibernate.SessionDelegator
beginTransaction, cancelQuery, clear, connection, contains, createCriteria, createCriteria, createCriteria, createCriteria, createFilter, createQuery, createSQLQuery, delete, disableFilter, disconnect, enableFilter, evict, flush, get, get, get, get, getCacheMode, getCurrentLockMode, getEnabledFilter, getEntityMode, getEntityName, getFlushMode, getIdentifier, getNamedQuery, getSession, getStatistics, handleException, isConnected, isDirty, isOpen, load, load, load, load, load, lock, lock, merge, merge, persist, persist, reconnect, reconnect, refresh, refresh, replicate, replicate, save, save, save, save, saveOrUpdate, saveOrUpdate, setCacheMode, setFlushMode, update, update, update, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FailoverSessionDelegator

public FailoverSessionDelegator(org.hibernate.SessionFactory sessionFactory)
Parameters:
sessionFactory - session factory to obtain session from

FailoverSessionDelegator

public FailoverSessionDelegator(org.hibernate.SessionFactory sessionFactory,
                                ExceptionHandler exceptionHandler)
Parameters:
sessionFactory - session factory to obtain session from
exceptionHandler - Exception handler component to use with created session

FailoverSessionDelegator

public FailoverSessionDelegator(org.hibernate.SessionFactory sessionFactory,
                                org.hibernate.Interceptor interceptor)
Parameters:
sessionFactory - sessionf actory to obtain session from
interceptor - interceptor to use with created session

FailoverSessionDelegator

public FailoverSessionDelegator(org.hibernate.SessionFactory sessionFactory,
                                org.hibernate.Interceptor interceptor,
                                ExceptionHandler exceptionHandler)
Parameters:
sessionFactory - sessionf actory to obtain session from
interceptor - interceptor to use with created session
exceptionHandler - Exception handler component to use with created session
Method Detail

getSessionFactory

public org.hibernate.SessionFactory getSessionFactory()
Specified by:
getSessionFactory in interface org.hibernate.Session
Overrides:
getSessionFactory in class SessionDelegator

getDelegatedSession

public org.hibernate.Session getDelegatedSession()
Obtain hibernate session in lazy way.

Specified by:
getDelegatedSession in class SessionDelegator

close

public Connection close()
                 throws org.hibernate.HibernateException
Specified by:
close in interface org.hibernate.Session
Overrides:
close in class SessionDelegator
Throws:
org.hibernate.HibernateException

invalidateDelegatedSession

public void invalidateDelegatedSession()
                                throws org.hibernate.HibernateException
Description copied from class: SessionDelegator
Perform actions to dispose "burned" session properly.

Specified by:
invalidateDelegatedSession in class SessionDelegator
Throws:
org.hibernate.HibernateException

getInterceptor

public org.hibernate.Interceptor getInterceptor()

setInterceptor

public void setInterceptor(org.hibernate.Interceptor interceptor)


Copyright 2003-2003-2006 Codehaus. All Rights Reserved.