|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.springframework.orm.hibernate3.SessionFactoryBeanDelegate
public class SessionFactoryBeanDelegate
Encapsulates common SessionFactoryBeanOperations behavior in order
to avoid multiple-inheritance issues with SessionFactoryBeanOperations
implementations that need to extend *SessionFactoryBuilder types.
Maintainer's note: Unless otherwise documented, JavaDoc for all methods is
inherited from SessionFactoryBeanOperations.
| Constructor Summary | |
|---|---|
SessionFactoryBeanDelegate(SessionFactoryBuilderSupport<?> builder)
Create a new SessionFactoryBeanDelegate |
|
| Method Summary | |
|---|---|
void |
afterPropertiesSet()
Build and expose the SessionFactory. |
void |
destroy()
Close the SessionFactory on bean factory shutdown. |
static org.hibernate.cache.CacheProvider |
getConfigTimeCacheProvider()
Deprecated. as of Spring 3.1 in favor of Hibernate's RegionFactory SPI |
org.hibernate.SessionFactory |
getObject()
Return the singleton SessionFactory. |
Class<? extends org.hibernate.SessionFactory> |
getObjectType()
Return the SessionFactory class used. |
org.hibernate.SessionFactory |
getSessionFactory()
Return the SessionFactory maintained by this delegate. |
boolean |
isSingleton()
Return true. |
void |
postBuildSessionFactory()
|
void |
preBuildSessionFactory()
|
void |
setBeanClassLoader(ClassLoader beanClassLoader)
Exists for compatibility with BeanClassLoaderAware but
simply delegates to
setClassLoader. |
void |
setCacheProvider(org.hibernate.cache.CacheProvider cacheProvider)
Deprecated. |
void |
setJdbcExceptionTranslator(SQLExceptionTranslator jdbcExceptionTranslator)
Set the JDBC exception translator for the SessionFactory on this instance's underlying HibernateExceptionTranslator. |
void |
setPersistenceExceptionTranslator(HibernateExceptionTranslator hibernateExceptionTranslator)
Customize the HibernateExceptionTranslator to be used when translating native
HibernateException types to Spring's DataAccessException hierarchy. |
DataAccessException |
translateExceptionIfPossible(RuntimeException ex)
Implementation of the PersistenceExceptionTranslator interface, as autodetected by Spring's PersistenceExceptionTranslationPostProcessor. |
org.hibernate.SessionFactory |
wrapSessionFactoryIfNecessary(org.hibernate.SessionFactory rawSf)
Override the default DisposableBean proxying behavior in
SessionFactoryBuilderSupport.wrapSessionFactoryIfNecessary(SessionFactory)
and return the raw SessionFactory instance, as SessionFactory.close()
will be called during this FactoryBean's normal destruction lifecycle. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SessionFactoryBeanDelegate(SessionFactoryBuilderSupport<?> builder)
SessionFactoryBeanDelegate
builder - the *SessionFactoryBuilder that delegates to this
instance.| Method Detail |
|---|
public org.hibernate.SessionFactory getSessionFactory()
SessionFactory maintained by this delegate.
@Deprecated public static org.hibernate.cache.CacheProvider getConfigTimeCacheProvider()
RegionFactory SPI
This instance will be set before initialization of the corresponding SessionFactory, and reset immediately afterwards. It is thus only available during configuration.
setCacheProvider(org.hibernate.cache.CacheProvider)@Deprecated public void setCacheProvider(org.hibernate.cache.CacheProvider cacheProvider)
SessionFactoryBeanOperationssetCacheRegionFactory
following Hibernate 3.3's deprecation of the CacheProvider SPI.
Set the Hibernate CacheProvider to use for the SessionFactory.
Allows for using a Spring-managed CacheProvider instance.
Note: If this is set, the Hibernate settings should not define a
cache provider to avoid meaningless double configuration.
of the CacheProvider SPI in favor of RegionFactory SPI.
setCacheProvider in interface SessionFactoryBeanOperationspublic void setPersistenceExceptionTranslator(HibernateExceptionTranslator hibernateExceptionTranslator)
SessionFactoryBeanOperationsHibernateExceptionTranslator to be used when translating native
HibernateException types to Spring's DataAccessException hierarchy.
setPersistenceExceptionTranslator in interface SessionFactoryBeanOperationspublic void setBeanClassLoader(ClassLoader beanClassLoader)
SessionFactoryBeanOperationsBeanClassLoaderAware but
simply delegates to
setClassLoader.
setBeanClassLoader in interface BeanClassLoaderAwaresetBeanClassLoader in interface SessionFactoryBeanOperationsbeanClassLoader - the owning class loader; may be null in
which case a default ClassLoader must be used, for example
the ClassLoader obtained via
ClassUtils.getDefaultClassLoader()public org.hibernate.SessionFactory getObject()
SessionFactoryBeanOperations
getObject in interface FactoryBean<org.hibernate.SessionFactory>getObject in interface SessionFactoryBeanOperationsnull)FactoryBeanNotInitializedExceptionpublic Class<? extends org.hibernate.SessionFactory> getObjectType()
SessionFactoryBeanOperations
getObjectType in interface FactoryBean<org.hibernate.SessionFactory>getObjectType in interface SessionFactoryBeanOperationsnull if not known at the time of the callListableBeanFactory.getBeansOfType(java.lang.Class) public boolean isSingleton()
SessionFactoryBeanOperationstrue.
isSingleton in interface FactoryBean<org.hibernate.SessionFactory>isSingleton in interface SessionFactoryBeanOperationsFactoryBean.getObject(),
SmartFactoryBean.isPrototype()
public void afterPropertiesSet()
throws Exception
SessionFactoryBeanOperations
afterPropertiesSet in interface InitializingBeanafterPropertiesSet in interface SessionFactoryBeanOperationsException - in the event of misconfiguration (such
as failure to set an essential property) or if initialization fails.SessionFactoryBuilderSupport.buildSessionFactory(),
SessionFactoryBuilderSupport.doBuildSessionFactory(),
SessionFactoryBuilderSupport.wrapSessionFactoryIfNecessary(org.hibernate.SessionFactory),
SessionFactoryBuilderSupport.afterSessionFactoryCreation()
public void destroy()
throws org.hibernate.HibernateException
SessionFactoryBeanOperations
destroy in interface DisposableBeandestroy in interface SessionFactoryBeanOperationsorg.hibernate.HibernateExceptionpublic void setJdbcExceptionTranslator(SQLExceptionTranslator jdbcExceptionTranslator)
SessionFactoryBeanOperationsHibernateExceptionTranslator.
Applied to any SQLException root cause of a Hibernate JDBCException, overriding Hibernate's default SQLException translation (which is based on Hibernate's Dialect for a specific target database).
setJdbcExceptionTranslator in interface SessionFactoryBeanOperationsjdbcExceptionTranslator - the exception translatorSessionFactoryBeanOperations.setPersistenceExceptionTranslator(HibernateExceptionTranslator),
HibernateExceptionTranslator.setJdbcExceptionTranslator(org.springframework.jdbc.support.SQLExceptionTranslator),
SQLException,
JDBCException,
SQLErrorCodeSQLExceptionTranslator,
SQLStateSQLExceptionTranslator,
PersistenceExceptionTranslatorpublic DataAccessException translateExceptionIfPossible(RuntimeException ex)
SessionFactoryBeanOperationsConverts the exception if it is a HibernateException;
else returns null to indicate an unknown exception.
translateExceptionIfPossible in interface PersistenceExceptionTranslatortranslateExceptionIfPossible in interface SessionFactoryBeanOperationsex - a RuntimeException thrown
null if the
exception could not be translated, as in this case it may result from
user code rather than an actual persistence problem)PersistenceExceptionTranslationPostProcessor,
#convertHibernateAccessExceptionpublic org.hibernate.SessionFactory wrapSessionFactoryIfNecessary(org.hibernate.SessionFactory rawSf)
SessionFactoryBeanOperationsDisposableBean proxying behavior in
SessionFactoryBuilderSupport.wrapSessionFactoryIfNecessary(SessionFactory)
and return the raw SessionFactory instance, as SessionFactory.close()
will be called during this FactoryBean's normal destruction lifecycle.
wrapSessionFactoryIfNecessary in interface SessionFactoryBeanOperationspublic void preBuildSessionFactory()
SessionFactoryBuilderSupport.preBuildSessionFactory()public void postBuildSessionFactory()
SessionFactoryBuilderSupport.postBuildSessionFactory()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||