@java.lang.Deprecated public class ConfigurableLocalSessionFactoryBean extends org.springframework.orm.hibernate4.HibernateExceptionTranslator
A SessionFactory bean that allows the configuration class to be changed and customise for usage within Grails.
Modifiers | Name | Description |
---|---|---|
protected org.springframework.context.ApplicationContext |
applicationContext |
|
protected java.lang.ClassLoader |
classLoader |
|
protected java.lang.Class<?> |
configClass |
|
protected java.lang.Class<?> |
currentSessionContextClass |
|
protected java.lang.String |
dataSourceName |
|
protected java.util.Map<java.lang.String, java.lang.Object> |
eventListeners |
|
protected grails.core.GrailsApplication |
grailsApplication |
|
protected HibernateEventListeners |
hibernateEventListeners |
|
protected boolean |
proxyIfReloadEnabled |
|
protected java.lang.String |
sessionFactoryBeanName |
Type | Name and description |
---|---|
void |
afterPropertiesSet() |
protected void |
buildSessionFactory() |
protected void |
buildSessionFactoryProxy() |
protected void |
configureGrailsJdbcTransactionFactory(org.hibernate.cfg.Configuration config) |
void |
destroy() |
protected org.hibernate.SessionFactory |
doBuildSessionFactory() |
java.lang.Class<?>[] |
getAnnotatedClasses() |
java.lang.String[] |
getAnnotatedPackages() |
org.springframework.core.io.Resource[] |
getCacheableMappingLocations() |
protected java.lang.String |
getCauseMessage(org.hibernate.HibernateException e) |
java.lang.Class<?> |
getConfigClass() |
org.springframework.core.io.Resource[] |
getConfigLocations() |
org.hibernate.cfg.Configuration |
getConfiguration() Return the Hibernate Configuration object used to build the SessionFactory. |
java.lang.Class<?> |
getCurrentSessionContextClass() |
javax.sql.DataSource |
getDataSource() |
java.lang.String |
getDataSourceName() |
org.hibernate.Interceptor |
getEntityInterceptor() |
java.util.Map<java.lang.String, java.lang.Object> |
getEventListeners() |
grails.core.GrailsApplication |
getGrailsApplication() |
HibernateEventListeners |
getHibernateEventListeners() |
java.util.Properties |
getHibernateProperties() Return the Hibernate properties, if any. |
org.springframework.core.io.Resource[] |
getMappingDirectoryLocations() |
org.springframework.core.io.Resource[] |
getMappingJarLocations() |
org.springframework.core.io.Resource[] |
getMappingLocations() |
java.lang.String[] |
getMappingResources() |
org.hibernate.cfg.NamingStrategy |
getNamingStrategy() |
org.hibernate.SessionFactory |
getObject() |
java.lang.Class<?> |
getObjectType() |
java.lang.String[] |
getPackagesToScan() |
java.lang.String |
getSessionFactoryBeanName() |
protected boolean |
isCacheConfigurationError(java.lang.Throwable cause) |
boolean |
isProxyIfReloadEnabled() |
boolean |
isSingleton() |
protected GrailsAnnotationConfiguration |
newConfiguration() |
void |
setAnnotatedClasses(java.lang.Class<?>[] annotatedClasses) Specify annotated entity classes to register with this Hibernate SessionFactory. |
void |
setAnnotatedPackages(java.lang.String[] annotatedPackages) Specify the names of annotated packages, for which package-level annotation metadata will be read. |
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
void |
setBeanClassLoader(java.lang.ClassLoader beanClassLoader) |
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". |
void |
setConfigClass(java.lang.Class<?> configClass) Sets the class to be used for Hibernate Configuration. |
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". |
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". |
void |
setCurrentSessionContextClass(java.lang.Class<?> currentSessionContextClass) Sets class to be used for the Hibernate CurrentSessionContext. |
void |
setDataSource(javax.sql.DataSource dataSource) Set the DataSource to be used by the SessionFactory. |
void |
setDataSourceName(java.lang.String name) |
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. |
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. |
void |
setGrailsApplication(grails.core.GrailsApplication grailsApplication) @param grailsApplication The grailsApplication to set. |
void |
setHibernateEventListeners(HibernateEventListeners listeners) |
void |
setHibernateProperties(java.util.Properties hibernateProperties) Set Hibernate properties, such as "hibernate.dialect". |
void |
setMappingDirectoryLocations(org.springframework.core.io.Resource[] mappingDirectoryLocations) Set locations of directories that contain Hibernate mapping resources, like "WEB-INF/mappings". |
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". |
void |
setMappingLocations(org.springframework.core.io.Resource[] mappingLocations) Set locations of Hibernate mapping files, for example as classpath resource "classpath:example.hbm.xml". |
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". |
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. |
void |
setPackagesToScan(java.lang.String... packagesToScan) Specify packages to search for autodetection of your entity classes in the classpath. |
void |
setProxyIfReloadEnabled(boolean proxyIfReloadEnabled) @param proxyIfReloadEnabled Sets whether a proxy should be created if reload is enabled |
void |
setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader) |
void |
setSessionFactoryBeanName(java.lang.String name) |
Methods inherited from class | Name |
---|---|
class org.springframework.orm.hibernate4.HibernateExceptionTranslator |
org.springframework.orm.hibernate4.HibernateExceptionTranslator#translateExceptionIfPossible(java.lang.RuntimeException), org.springframework.orm.hibernate4.HibernateExceptionTranslator#wait(long, int), org.springframework.orm.hibernate4.HibernateExceptionTranslator#wait(long), org.springframework.orm.hibernate4.HibernateExceptionTranslator#wait(), org.springframework.orm.hibernate4.HibernateExceptionTranslator#equals(java.lang.Object), org.springframework.orm.hibernate4.HibernateExceptionTranslator#toString(), org.springframework.orm.hibernate4.HibernateExceptionTranslator#hashCode(), org.springframework.orm.hibernate4.HibernateExceptionTranslator#getClass(), org.springframework.orm.hibernate4.HibernateExceptionTranslator#notify(), org.springframework.orm.hibernate4.HibernateExceptionTranslator#notifyAll() |
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#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 values
grailsApplication
- The grailsApplication to set.Set 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