org.nanocontainer.persistence.hibernate.classic
Class FailoverSessionDelegator

java.lang.Object
  extended by org.nanocontainer.persistence.hibernate.classic.SessionDelegator
      extended by org.nanocontainer.persistence.hibernate.classic.FailoverSessionDelegator
All Implemented Interfaces:
Serializable, net.sf.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:
Konstantin Pribluda, Jose Peleteiro
See Also:
Serialized Form

Field Summary
(package private)  net.sf.hibernate.Interceptor interceptor
           
(package private)  net.sf.hibernate.Session session
           
(package private)  net.sf.hibernate.SessionFactory sessionFactory
           
 
Constructor Summary
FailoverSessionDelegator(net.sf.hibernate.SessionFactory sessionFactory)
           
FailoverSessionDelegator(net.sf.hibernate.SessionFactory sessionFactory, HibernateExceptionHandler exceptionHandler)
           
FailoverSessionDelegator(net.sf.hibernate.SessionFactory sessionFactory, net.sf.hibernate.Interceptor interceptor)
           
FailoverSessionDelegator(net.sf.hibernate.SessionFactory sessionFactory, net.sf.hibernate.Interceptor interceptor, HibernateExceptionHandler exceptionHandler)
           
 
Method Summary
 Connection close()
           
 net.sf.hibernate.Session getDelegatedSession()
          obtain hibernate session in lazy way.
 net.sf.hibernate.Interceptor getInterceptor()
           
 net.sf.hibernate.SessionFactory getSessionFactory()
           
 void invalidateDelegatedSession()
          perform actions to dispose "burned" session properly
 void setInterceptor(net.sf.hibernate.Interceptor interceptor)
           
 void setSessionFactory(net.sf.hibernate.SessionFactory sessionFactory)
           
 
Methods inherited from class org.nanocontainer.persistence.hibernate.classic.SessionDelegator
beginTransaction, cancelQuery, clear, connection, contains, createCriteria, createFilter, createQuery, createSQLQuery, createSQLQuery, delete, delete, delete, delete, disconnect, evict, filter, filter, filter, find, find, find, flush, get, get, getCurrentLockMode, getFlushMode, getIdentifier, getNamedQuery, handleException, handleException, isConnected, isDirty, isOpen, iterate, iterate, iterate, load, load, load, lock, reconnect, reconnect, refresh, refresh, replicate, save, save, saveOrUpdate, saveOrUpdateCopy, saveOrUpdateCopy, setFlushMode, update, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

interceptor

net.sf.hibernate.Interceptor interceptor

session

net.sf.hibernate.Session session

sessionFactory

net.sf.hibernate.SessionFactory sessionFactory
Constructor Detail

FailoverSessionDelegator

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

FailoverSessionDelegator

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

FailoverSessionDelegator

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

FailoverSessionDelegator

public FailoverSessionDelegator(net.sf.hibernate.SessionFactory sessionFactory,
                                net.sf.hibernate.Interceptor interceptor,
                                HibernateExceptionHandler 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

close

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

getDelegatedSession

public net.sf.hibernate.Session getDelegatedSession()
obtain hibernate session in lazy way. use interceptor if configured

Specified by:
getDelegatedSession in class SessionDelegator

getInterceptor

public net.sf.hibernate.Interceptor getInterceptor()

getSessionFactory

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

invalidateDelegatedSession

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

Specified by:
invalidateDelegatedSession in class SessionDelegator
Throws:
net.sf.hibernate.HibernateException

setInterceptor

public void setInterceptor(net.sf.hibernate.Interceptor interceptor)

setSessionFactory

public void setSessionFactory(net.sf.hibernate.SessionFactory sessionFactory)


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