|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.nanocontainer.persistence.hibernate.SessionComponent
public class SessionComponent
Session component with failover behaviour in case of hibernate exception. Old session is disposed and new one is obtained transparently. Session creation is done lazily.
| Field Summary | |
|---|---|
protected ExceptionHandler |
hibernateExceptionHandler
|
| Constructor Summary | |
|---|---|
SessionComponent(org.hibernate.SessionFactory sessionFactory)
|
|
SessionComponent(org.hibernate.SessionFactory sessionFactory,
ExceptionHandler hibernateExceptionHandler)
|
|
SessionComponent(org.hibernate.SessionFactory sessionFactory,
ExceptionHandler hibernateExceptionHandler,
org.hibernate.Interceptor interceptor)
|
|
SessionComponent(org.hibernate.SessionFactory sessionFactory,
org.hibernate.Interceptor interceptor)
|
|
| Method Summary | |
|---|---|
org.hibernate.Transaction |
beginTransaction()
|
void |
cancelQuery()
|
void |
clear()
|
Connection |
close()
|
Connection |
connection()
|
boolean |
contains(Object object)
|
org.hibernate.Criteria |
createCriteria(Class persistentClass)
|
org.hibernate.Criteria |
createCriteria(Class persistentClass,
String alias)
|
org.hibernate.Criteria |
createCriteria(String entityName)
|
org.hibernate.Criteria |
createCriteria(String entityName,
String alias)
|
org.hibernate.Query |
createFilter(Object collection,
String queryString)
|
org.hibernate.Query |
createQuery(String queryString)
|
org.hibernate.SQLQuery |
createSQLQuery(String queryString)
|
void |
delete(Object object)
|
void |
disableFilter(String filterName)
|
Connection |
disconnect()
|
org.hibernate.Filter |
enableFilter(String filterName)
|
void |
evict(Object object)
|
void |
flush()
|
Object |
get(Class clazz,
Serializable id)
|
Object |
get(Class clazz,
Serializable id,
org.hibernate.LockMode lockMode)
|
Object |
get(String entityName,
Serializable id)
|
Object |
get(String entityName,
Serializable id,
org.hibernate.LockMode lockMode)
|
org.hibernate.CacheMode |
getCacheMode()
|
org.hibernate.LockMode |
getCurrentLockMode(Object object)
|
protected org.hibernate.Session |
getDelegatedSession()
Calls getDelegatedSession(true) |
protected org.hibernate.Session |
getDelegatedSession(boolean create)
Obtain hibernate session. |
org.hibernate.Filter |
getEnabledFilter(String filterName)
|
org.hibernate.EntityMode |
getEntityMode()
|
String |
getEntityName(Object object)
|
org.hibernate.FlushMode |
getFlushMode()
|
Serializable |
getIdentifier(Object object)
|
org.hibernate.Query |
getNamedQuery(String queryName)
|
org.hibernate.Session |
getSession(org.hibernate.EntityMode entityMode)
|
org.hibernate.SessionFactory |
getSessionFactory()
|
org.hibernate.stat.SessionStatistics |
getStatistics()
|
protected RuntimeException |
handleException(RuntimeException cause)
Invalidates the session calling invalidateDelegatedSession() and convert the cause using
a ExceptionHandler if it's available otherwise just return the cause back. |
protected void |
invalidateDelegatedSession()
Perform actions to dispose "burned" session properly. |
boolean |
isConnected()
|
boolean |
isDirty()
|
boolean |
isOpen()
|
Object |
load(Class theClass,
Serializable id)
|
Object |
load(Class theClass,
Serializable id,
org.hibernate.LockMode lockMode)
|
void |
load(Object object,
Serializable id)
|
Object |
load(String entityName,
Serializable id)
|
Object |
load(String entityName,
Serializable id,
org.hibernate.LockMode lockMode)
|
void |
lock(Object object,
org.hibernate.LockMode lockMode)
|
void |
lock(String entityEntity,
Object object,
org.hibernate.LockMode lockMode)
|
Object |
merge(Object object)
|
Object |
merge(String entityName,
Object object)
|
void |
persist(Object object)
|
void |
persist(String entityName,
Object object)
|
void |
reconnect()
|
void |
reconnect(Connection conn)
|
void |
refresh(Object object)
|
void |
refresh(Object object,
org.hibernate.LockMode lockMode)
|
void |
replicate(Object object,
org.hibernate.ReplicationMode replicationMode)
|
void |
replicate(String entityName,
Object object,
org.hibernate.ReplicationMode replicationMode)
|
Serializable |
save(Object object)
|
void |
save(Object object,
Serializable id)
|
Serializable |
save(String entityName,
Object object)
|
void |
save(String entityName,
Object object,
Serializable id)
|
void |
saveOrUpdate(Object object)
|
void |
saveOrUpdate(String entityName,
Object object)
|
void |
setCacheMode(org.hibernate.CacheMode cacheMode)
|
void |
setFlushMode(org.hibernate.FlushMode value)
|
void |
start()
org.picocontainer.Startable.start() |
void |
stop()
org.picocontainer.Startable.stop() |
void |
update(Object object)
|
void |
update(Object object,
Serializable id)
|
void |
update(String entityName,
Object object)
|
void |
update(String entityName,
Object object,
Serializable id)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected ExceptionHandler hibernateExceptionHandler
| Constructor Detail |
|---|
public SessionComponent(org.hibernate.SessionFactory sessionFactory)
public SessionComponent(org.hibernate.SessionFactory sessionFactory,
ExceptionHandler hibernateExceptionHandler)
public SessionComponent(org.hibernate.SessionFactory sessionFactory,
org.hibernate.Interceptor interceptor)
public SessionComponent(org.hibernate.SessionFactory sessionFactory,
ExceptionHandler hibernateExceptionHandler,
org.hibernate.Interceptor interceptor)
| Method Detail |
|---|
protected final org.hibernate.Session getDelegatedSession(boolean create)
protected final org.hibernate.Session getDelegatedSession()
protected void invalidateDelegatedSession()
throws org.hibernate.HibernateException
org.hibernate.HibernateException
protected RuntimeException handleException(RuntimeException cause)
throws org.hibernate.HibernateException
invalidateDelegatedSession() and convert the cause using
a ExceptionHandler if it's available otherwise just return the cause back.
org.hibernate.HibernateExceptionpublic void start()
start in interface org.picocontainer.Startablepublic void stop()
stop in interface org.picocontainer.Startable
public org.hibernate.Transaction beginTransaction()
throws org.hibernate.HibernateException
beginTransaction in interface org.hibernate.Sessionorg.hibernate.HibernateException
public void cancelQuery()
throws org.hibernate.HibernateException
cancelQuery in interface org.hibernate.Sessionorg.hibernate.HibernateExceptionpublic void clear()
clear in interface org.hibernate.Session
public Connection close()
throws org.hibernate.HibernateException
close in interface org.hibernate.Sessionorg.hibernate.HibernateException
public Connection connection()
throws org.hibernate.HibernateException
connection in interface org.hibernate.Sessionorg.hibernate.HibernateExceptionpublic boolean contains(Object object)
contains in interface org.hibernate.Sessionpublic org.hibernate.Criteria createCriteria(Class persistentClass)
createCriteria in interface org.hibernate.Session
public org.hibernate.Criteria createCriteria(Class persistentClass,
String alias)
createCriteria in interface org.hibernate.Sessionpublic org.hibernate.Criteria createCriteria(String entityName)
createCriteria in interface org.hibernate.Session
public org.hibernate.Criteria createCriteria(String entityName,
String alias)
createCriteria in interface org.hibernate.Session
public org.hibernate.Query createFilter(Object collection,
String queryString)
throws org.hibernate.HibernateException
createFilter in interface org.hibernate.Sessionorg.hibernate.HibernateException
public org.hibernate.Query createQuery(String queryString)
throws org.hibernate.HibernateException
createQuery in interface org.hibernate.Sessionorg.hibernate.HibernateException
public org.hibernate.SQLQuery createSQLQuery(String queryString)
throws org.hibernate.HibernateException
createSQLQuery in interface org.hibernate.Sessionorg.hibernate.HibernateException
public void delete(Object object)
throws org.hibernate.HibernateException
delete in interface org.hibernate.Sessionorg.hibernate.HibernateExceptionpublic void disableFilter(String filterName)
disableFilter in interface org.hibernate.Session
public Connection disconnect()
throws org.hibernate.HibernateException
disconnect in interface org.hibernate.Sessionorg.hibernate.HibernateExceptionpublic org.hibernate.Filter enableFilter(String filterName)
enableFilter in interface org.hibernate.Session
public void evict(Object object)
throws org.hibernate.HibernateException
evict in interface org.hibernate.Sessionorg.hibernate.HibernateException
public void flush()
throws org.hibernate.HibernateException
flush in interface org.hibernate.Sessionorg.hibernate.HibernateException
public Object get(Class clazz,
Serializable id)
throws org.hibernate.HibernateException
get in interface org.hibernate.Sessionorg.hibernate.HibernateException
public Object get(Class clazz,
Serializable id,
org.hibernate.LockMode lockMode)
throws org.hibernate.HibernateException
get in interface org.hibernate.Sessionorg.hibernate.HibernateException
public Object get(String entityName,
Serializable id)
throws org.hibernate.HibernateException
get in interface org.hibernate.Sessionorg.hibernate.HibernateException
public Object get(String entityName,
Serializable id,
org.hibernate.LockMode lockMode)
throws org.hibernate.HibernateException
get in interface org.hibernate.Sessionorg.hibernate.HibernateExceptionpublic org.hibernate.CacheMode getCacheMode()
getCacheMode in interface org.hibernate.Session
public org.hibernate.LockMode getCurrentLockMode(Object object)
throws org.hibernate.HibernateException
getCurrentLockMode in interface org.hibernate.Sessionorg.hibernate.HibernateExceptionpublic org.hibernate.Filter getEnabledFilter(String filterName)
getEnabledFilter in interface org.hibernate.Sessionpublic org.hibernate.EntityMode getEntityMode()
getEntityMode in interface org.hibernate.Session
public String getEntityName(Object object)
throws org.hibernate.HibernateException
getEntityName in interface org.hibernate.Sessionorg.hibernate.HibernateExceptionpublic org.hibernate.FlushMode getFlushMode()
getFlushMode in interface org.hibernate.Session
public Serializable getIdentifier(Object object)
throws org.hibernate.HibernateException
getIdentifier in interface org.hibernate.Sessionorg.hibernate.HibernateException
public org.hibernate.Query getNamedQuery(String queryName)
throws org.hibernate.HibernateException
getNamedQuery in interface org.hibernate.Sessionorg.hibernate.HibernateExceptionpublic org.hibernate.Session getSession(org.hibernate.EntityMode entityMode)
getSession in interface org.hibernate.Sessionpublic org.hibernate.SessionFactory getSessionFactory()
getSessionFactory in interface org.hibernate.Sessionpublic org.hibernate.stat.SessionStatistics getStatistics()
getStatistics in interface org.hibernate.Sessionpublic boolean isConnected()
isConnected in interface org.hibernate.Session
public boolean isDirty()
throws org.hibernate.HibernateException
isDirty in interface org.hibernate.Sessionorg.hibernate.HibernateExceptionpublic boolean isOpen()
isOpen in interface org.hibernate.Session
public Object load(Class theClass,
Serializable id)
throws org.hibernate.HibernateException
load in interface org.hibernate.Sessionorg.hibernate.HibernateException
public Object load(Class theClass,
Serializable id,
org.hibernate.LockMode lockMode)
throws org.hibernate.HibernateException
load in interface org.hibernate.Sessionorg.hibernate.HibernateException
public void load(Object object,
Serializable id)
throws org.hibernate.HibernateException
load in interface org.hibernate.Sessionorg.hibernate.HibernateException
public Object load(String entityName,
Serializable id)
throws org.hibernate.HibernateException
load in interface org.hibernate.Sessionorg.hibernate.HibernateException
public Object load(String entityName,
Serializable id,
org.hibernate.LockMode lockMode)
throws org.hibernate.HibernateException
load in interface org.hibernate.Sessionorg.hibernate.HibernateException
public void lock(Object object,
org.hibernate.LockMode lockMode)
throws org.hibernate.HibernateException
lock in interface org.hibernate.Sessionorg.hibernate.HibernateException
public void lock(String entityEntity,
Object object,
org.hibernate.LockMode lockMode)
throws org.hibernate.HibernateException
lock in interface org.hibernate.Sessionorg.hibernate.HibernateException
public Object merge(Object object)
throws org.hibernate.HibernateException
merge in interface org.hibernate.Sessionorg.hibernate.HibernateException
public Object merge(String entityName,
Object object)
throws org.hibernate.HibernateException
merge in interface org.hibernate.Sessionorg.hibernate.HibernateException
public void persist(Object object)
throws org.hibernate.HibernateException
persist in interface org.hibernate.Sessionorg.hibernate.HibernateException
public void persist(String entityName,
Object object)
throws org.hibernate.HibernateException
persist in interface org.hibernate.Sessionorg.hibernate.HibernateException
public void reconnect()
throws org.hibernate.HibernateException
reconnect in interface org.hibernate.Sessionorg.hibernate.HibernateException
public void reconnect(Connection conn)
throws org.hibernate.HibernateException
reconnect in interface org.hibernate.Sessionorg.hibernate.HibernateException
public void refresh(Object object)
throws org.hibernate.HibernateException
refresh in interface org.hibernate.Sessionorg.hibernate.HibernateException
public void refresh(Object object,
org.hibernate.LockMode lockMode)
throws org.hibernate.HibernateException
refresh in interface org.hibernate.Sessionorg.hibernate.HibernateException
public void replicate(Object object,
org.hibernate.ReplicationMode replicationMode)
throws org.hibernate.HibernateException
replicate in interface org.hibernate.Sessionorg.hibernate.HibernateException
public void replicate(String entityName,
Object object,
org.hibernate.ReplicationMode replicationMode)
throws org.hibernate.HibernateException
replicate in interface org.hibernate.Sessionorg.hibernate.HibernateException
public Serializable save(Object object)
throws org.hibernate.HibernateException
save in interface org.hibernate.Sessionorg.hibernate.HibernateException
public void save(Object object,
Serializable id)
throws org.hibernate.HibernateException
save in interface org.hibernate.Sessionorg.hibernate.HibernateException
public Serializable save(String entityName,
Object object)
throws org.hibernate.HibernateException
save in interface org.hibernate.Sessionorg.hibernate.HibernateException
public void save(String entityName,
Object object,
Serializable id)
throws org.hibernate.HibernateException
save in interface org.hibernate.Sessionorg.hibernate.HibernateException
public void saveOrUpdate(Object object)
throws org.hibernate.HibernateException
saveOrUpdate in interface org.hibernate.Sessionorg.hibernate.HibernateException
public void saveOrUpdate(String entityName,
Object object)
throws org.hibernate.HibernateException
saveOrUpdate in interface org.hibernate.Sessionorg.hibernate.HibernateExceptionpublic void setCacheMode(org.hibernate.CacheMode cacheMode)
setCacheMode in interface org.hibernate.Sessionpublic void setFlushMode(org.hibernate.FlushMode value)
setFlushMode in interface org.hibernate.Session
public void update(Object object)
throws org.hibernate.HibernateException
update in interface org.hibernate.Sessionorg.hibernate.HibernateException
public void update(Object object,
Serializable id)
throws org.hibernate.HibernateException
update in interface org.hibernate.Sessionorg.hibernate.HibernateException
public void update(String entityName,
Object object)
throws org.hibernate.HibernateException
update in interface org.hibernate.Sessionorg.hibernate.HibernateException
public void update(String entityName,
Object object,
Serializable id)
throws org.hibernate.HibernateException
update in interface org.hibernate.Sessionorg.hibernate.HibernateException
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||