|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.springframework.orm.hibernate4.SessionFactoryUtils
public abstract class SessionFactoryUtils
Helper class featuring methods for Hibernate Session handling. Also provides support for exception translation.
Used internally by HibernateTransactionManager.
Can also be used directly in application code.
HibernateExceptionTranslator,
HibernateTransactionManager| Field Summary | |
|---|---|
static int |
SESSION_SYNCHRONIZATION_ORDER
Order value for TransactionSynchronization objects that clean up Hibernate Sessions. |
| Constructor Summary | |
|---|---|
SessionFactoryUtils()
|
|
| Method Summary | |
|---|---|
static void |
closeSession(Session session)
Perform actual closing of the Hibernate Session, catching and logging any cleanup exceptions thrown. |
static DataAccessException |
convertHibernateAccessException(HibernateException ex)
Convert the given HibernateException to an appropriate exception from the org.springframework.dao hierarchy. |
static DataSource |
getDataSource(SessionFactory sessionFactory)
Determine the DataSource of the given SessionFactory. |
static Session |
openSession(SessionFactory sessionFactory)
Obtain a new Session from the given SessionFactory. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int SESSION_SYNCHRONIZATION_ORDER
DataSourceUtils.CONNECTION_SYNCHRONIZATION_ORDER - 100
to execute Session cleanup before JDBC Connection cleanup, if any.
DataSourceUtils.CONNECTION_SYNCHRONIZATION_ORDER,
Constant Field Values| Constructor Detail |
|---|
public SessionFactoryUtils()
| Method Detail |
|---|
public static DataSource getDataSource(SessionFactory sessionFactory)
sessionFactory - the SessionFactory to check
null if none foundSessionFactoryImplementor.getConnectionProvider()public static Session openSession(SessionFactory sessionFactory)
Bridges between Hibernate signature differences.
sessionFactory - the SessionFactory to use
SessionFactory.openSession()public static void closeSession(Session session)
session - the Hibernate Session to close (may be null)Session.close()public static DataAccessException convertHibernateAccessException(HibernateException ex)
org.springframework.dao hierarchy.
ex - HibernateException that occured
HibernateExceptionTranslator.convertHibernateAccessException(org.hibernate.HibernateException),
HibernateTransactionManager.convertHibernateAccessException(org.hibernate.HibernateException)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||