public class HibernateMappingContextSessionFactoryBean extends org.springframework.orm.hibernate5.HibernateExceptionTranslator implements org.springframework.beans.factory.FactoryBean, org.springframework.context.ResourceLoaderAware, org.springframework.beans.factory.DisposableBean, org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.BeanClassLoaderAware
Configures a SessionFactory using a HibernateMappingContext and a HibernateMappingContextConfiguration
Modifiers | Name | Description |
---|---|---|
protected org.springframework.context.ApplicationContext |
applicationContext |
|
protected java.lang.ClassLoader |
classLoader |
|
protected java.lang.Class<? extends HibernateMappingContextConfiguration> |
configClass |
|
protected java.lang.Class<?> |
currentSessionContextClass |
|
protected java.lang.String |
dataSourceName |
|
protected java.util.Map<java.lang.String, java.lang.Object> |
eventListeners |
|
protected HibernateEventListeners |
hibernateEventListeners |
|
protected HibernateMappingContext |
hibernateMappingContext |
|
protected boolean |
proxyIfReloadEnabled |
|
protected java.lang.String |
sessionFactoryBeanName |
|
protected org.springframework.transaction.PlatformTransactionManager |
transactionManager |
Type Params | Return Type | Name and description |
---|---|---|
|
public void |
afterPropertiesSet() |
|
protected void |
buildSessionFactory() |
|
public void |
destroy() |
|
protected org.hibernate.SessionFactory |
doBuildSessionFactory() |
|
public java.lang.Class<?>[] |
getAnnotatedClasses() |
|
public java.lang.String[] |
getAnnotatedPackages() |
|
public org.springframework.core.io.Resource[] |
getCacheableMappingLocations() |
|
public java.lang.Class<? extends HibernateMappingContextConfiguration> |
getConfigClass() |
|
public org.springframework.core.io.Resource[] |
getConfigLocations() |
|
public final org.springframework.context.annotation.Configuration |
getConfiguration() Return the Hibernate Configuration object used to build the SessionFactory. |
|
public java.lang.Class<?> |
getCurrentSessionContextClass() |
|
public javax.sql.DataSource |
getDataSource() |
|
public java.lang.String |
getDataSourceName() |
|
public org.hibernate.Interceptor |
getEntityInterceptor() |
|
public java.util.Map<java.lang.String, java.lang.Object> |
getEventListeners() |
|
public HibernateEventListeners |
getHibernateEventListeners() |
|
public java.util.Properties |
getHibernateProperties() Return the Hibernate properties, if any. |
|
public org.springframework.core.io.Resource[] |
getMappingDirectoryLocations() |
|
public org.springframework.core.io.Resource[] |
getMappingJarLocations() |
|
public org.springframework.core.io.Resource[] |
getMappingLocations() |
|
public java.lang.String[] |
getMappingResources() |
|
public org.hibernate.cfg.NamingStrategy |
getNamingStrategy() |
|
public org.hibernate.SessionFactory |
getObject() |
|
public java.lang.Class<?> |
getObjectType() |
|
public java.lang.String[] |
getPackagesToScan() |
|
public java.lang.String |
getSessionFactoryBeanName() |
|
public org.springframework.transaction.PlatformTransactionManager |
getTransactionManager() |
|
public boolean |
isProxyIfReloadEnabled() |
|
public boolean |
isSingleton() |
|
protected HibernateMappingContextConfiguration |
newConfiguration() |
|
public void |
setAnnotatedClasses(java.lang.Class<?>[] annotatedClasses) Specify annotated entity classes to register with this Hibernate SessionFactory. |
|
public void |
setAnnotatedPackages(java.lang.String[] annotatedPackages) Specify the names of annotated packages, for which package-level annotation metadata will be read. |
|
public void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
|
public void |
setBeanClassLoader(java.lang.ClassLoader classLoader) |
|
public void |
setCacheableMappingLocations(org.springframework.core.io.Resource[] cacheableMappingLocations) Set locations of cacheable Hibernate mapping files, for example as web app resource "/WEB-INF/mapping/example.hbm.xml". |
|
public void |
setConfigClass(java.lang.Class<? extends HibernateMappingContextConfiguration> configClass) Sets the class to be used for Hibernate Configuration. |
|
public void |
setConfigLocation(org.springframework.core.io.Resource configLocation) Set the location of a single Hibernate XML config file, for example as classpath resource "classpath:hibernate.cfg.xml". |
|
public void |
setConfigLocations(org.springframework.core.io.Resource[] configLocations) Set the locations of multiple Hibernate XML config files, for example as classpath resources "classpath:hibernate.cfg.xml,classpath:extension.cfg.xml". |
|
public void |
setCurrentSessionContextClass(java.lang.Class<?> currentSessionContextClass) Sets class to be used for the Hibernate CurrentSessionContext. |
|
public void |
setDataSource(javax.sql.DataSource dataSource) Set the DataSource to be used by the SessionFactory. |
|
public void |
setDataSourceName(java.lang.String name) |
|
public void |
setEntityInterceptor(org.hibernate.Interceptor entityInterceptor) Set a Hibernate entity interceptor that allows to inspect and change property values before writing to and reading from the database. |
|
public void |
setEventListeners(java.util.Map<java.lang.String, java.lang.Object> eventListeners) Specify the Hibernate event listeners to register, with listener types as keys and listener objects as values. |
|
public void |
setHibernateEventListeners(HibernateEventListeners listeners) |
|
public void |
setHibernateMappingContext(HibernateMappingContext hibernateMappingContext) |
|
public void |
setHibernateProperties(java.util.Properties hibernateProperties) Set Hibernate properties, such as "hibernate.dialect". |
|
public void |
setMappingDirectoryLocations(org.springframework.core.io.Resource[] mappingDirectoryLocations) Set locations of directories that contain Hibernate mapping resources, like "WEB-INF/mappings". |
|
public void |
setMappingJarLocations(org.springframework.core.io.Resource[] mappingJarLocations) Set locations of jar files that contain Hibernate mapping resources, like "WEB-INF/lib/example.hbm.jar". |
|
public void |
setMappingLocations(org.springframework.core.io.Resource[] mappingLocations) Set locations of Hibernate mapping files, for example as classpath resource "classpath:example.hbm.xml". |
|
public void |
setMappingResources(java.lang.String[] mappingResources) Set Hibernate mapping resources to be found in the class path, like "example.hbm.xml" or "mypackage/example.hbm.xml". |
|
public void |
setNamingStrategy(org.hibernate.cfg.NamingStrategy namingStrategy) Set a Hibernate NamingStrategy for the SessionFactory, determining the physical column and table names given the info in the mapping document. |
|
public void |
setPackagesToScan(java.lang.String packagesToScan) Specify packages to search for autodetection of your entity classes in the classpath. |
|
public void |
setProxyIfReloadEnabled(boolean proxyIfReloadEnabled)
|
|
public void |
setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader) |
|
public void |
setSessionFactoryBeanName(java.lang.String name) |
|
public void |
setTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager) |
Methods inherited from class | Name |
---|---|
class org.springframework.orm.hibernate5.HibernateExceptionTranslator |
org.springframework.orm.hibernate5.HibernateExceptionTranslator#setJdbcExceptionTranslator(org.springframework.jdbc.support.SQLExceptionTranslator), org.springframework.orm.hibernate5.HibernateExceptionTranslator#translateExceptionIfPossible(java.lang.RuntimeException), org.springframework.orm.hibernate5.HibernateExceptionTranslator#wait(long), org.springframework.orm.hibernate5.HibernateExceptionTranslator#wait(long, int), org.springframework.orm.hibernate5.HibernateExceptionTranslator#wait(), org.springframework.orm.hibernate5.HibernateExceptionTranslator#equals(java.lang.Object), org.springframework.orm.hibernate5.HibernateExceptionTranslator#toString(), org.springframework.orm.hibernate5.HibernateExceptionTranslator#hashCode(), org.springframework.orm.hibernate5.HibernateExceptionTranslator#getClass(), org.springframework.orm.hibernate5.HibernateExceptionTranslator#notify(), org.springframework.orm.hibernate5.HibernateExceptionTranslator#notifyAll() |
Return the Hibernate Configuration object used to build the SessionFactory. Allows for access to configuration metadata stored there (rarely needed).
Return the Hibernate properties, if any. Mainly available for configuration through property paths that specify individual keys.
Specify annotated entity classes to register with this Hibernate SessionFactory.
Specify the names of annotated packages, for which package-level annotation metadata will be read.
Set locations of cacheable Hibernate mapping files, for example as web app resource "/WEB-INF/mapping/example.hbm.xml". Supports any resource location via Spring's resource abstraction, as long as the resource can be resolved in the file system.
Can be used to add to mappings from a Hibernate XML config file, or to specify all mappings locally.
Sets the class to be used for Hibernate Configuration.
configClass
- A subclass of the Hibernate Configuration classSet the location of a single Hibernate XML config file, for example as classpath resource "classpath:hibernate.cfg.xml".
Note: Can be omitted when all necessary properties and mapping resources are specified locally via this bean.
Set the locations of multiple Hibernate XML config files, for example as classpath resources "classpath:hibernate.cfg.xml,classpath:extension.cfg.xml".
Note: Can be omitted when all necessary properties and mapping resources are specified locally via this bean.
Sets class to be used for the Hibernate CurrentSessionContext.
currentSessionContextClass
- An implementation of the CurrentSessionContext interfaceSet the DataSource to be used by the SessionFactory. If set, this will override corresponding settings in Hibernate properties.
If this is set, the Hibernate settings should not define a connection provider to avoid meaningless double configuration.
Set a Hibernate entity interceptor that allows to inspect and change property values before writing to and reading from the database. Will get applied to any new Session created by this factory.
Specify the Hibernate event listeners to register, with listener types as keys and listener objects as values. Instead of a single listener object, you can also pass in a list or set of listeners objects as value.
See the Hibernate documentation for further details on listener types and associated listener interfaces.
eventListeners
- Map with listener type Strings as keys and
listener objects as valuesSet Hibernate properties, such as "hibernate.dialect".
Note: Do not specify a transaction provider here when using Spring-driven transactions. It is also advisable to omit connection provider settings and use a Spring-set DataSource instead.
Set locations of directories that contain Hibernate mapping resources, like "WEB-INF/mappings".
Can be used to add to mappings from a Hibernate XML config file, or to specify all mappings locally.
Set locations of jar files that contain Hibernate mapping resources, like "WEB-INF/lib/example.hbm.jar".
Can be used to add to mappings from a Hibernate XML config file, or to specify all mappings locally.
Set locations of Hibernate mapping files, for example as classpath resource "classpath:example.hbm.xml". Supports any resource location via Spring's resource abstraction, for example relative paths like "WEB-INF/mappings/example.hbm.xml" when running in an application context.
Can be used to add to mappings from a Hibernate XML config file, or to specify all mappings locally.
Set Hibernate mapping resources to be found in the class path, like "example.hbm.xml" or "mypackage/example.hbm.xml". Analogous to mapping entries in a Hibernate XML config file. Alternative to the more generic setMappingLocations method.
Can be used to add to mappings from a Hibernate XML config file, or to specify all mappings locally.
Set a Hibernate NamingStrategy for the SessionFactory, determining the physical column and table names given the info in the mapping document.
Specify packages to search for autodetection of your entity classes in the classpath. This is analogous to Spring's component-scan feature (org.springframework.context.annotation.ClassPathBeanDefinitionScanner).
proxyIfReloadEnabled
- Sets whether a proxy should be created if reload is enabled