Groovy Documentation

org.codehaus.groovy.grails.orm.hibernate
[Java] Class ConfigurableLocalSessionFactoryBean

java.lang.Object
  org.springframework.orm.hibernate3.HibernateExceptionTranslator
      org.springframework.orm.hibernate3.AbstractSessionFactoryBean
          org.springframework.orm.hibernate3.LocalSessionFactoryBean
              org.codehaus.groovy.grails.orm.hibernate.ConfigurableLocalSessionFactoryBean
All Implemented Interfaces:
org.springframework.context.ApplicationContextAware

public class ConfigurableLocalSessionFactoryBean
extends org.springframework.orm.hibernate3.LocalSessionFactoryBean

A SessionFactory bean that allows the configuration class to be changed and customise for usage within Grails.

Authors:
Graeme Rocher
Since:
07-Jul-2005


Field Summary
protected static org.apache.commons.logging.Log LOG

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 GrailsApplication grailsApplication

protected HibernateEventListeners hibernateEventListeners

protected boolean proxyIfReloadEnabled

protected java.lang.String sessionFactoryBeanName

 
Method Summary
protected void addNewListenerToConfiguration(org.hibernate.cfg.Configuration config, java.lang.String listenerType, java.lang.Class klass, java.lang.Object[] currentListeners, java.util.Map newlistenerMap)

void afterPropertiesSet()

void destroy()

protected java.lang.String getCauseMessage(org.hibernate.HibernateException e)

GrailsApplication getGrailsApplication()

@return Returns the grailsApplication.

protected boolean isCacheConfigurationError(java.lang.Throwable cause)

protected org.hibernate.cfg.Configuration newConfiguration()

Overrides default behaviour to allow for a configurable configuration class.

protected org.hibernate.SessionFactory newSessionFactory(org.hibernate.cfg.Configuration configuration)

protected void postProcessConfiguration(org.hibernate.cfg.Configuration config)

void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)

void setBeanClassLoader(java.lang.ClassLoader beanClassLoader)

void setConfigClass(java.lang.Class configClass)

Sets the class to be used for Hibernate Configuration.

void setCurrentSessionContextClass(java.lang.Class currentSessionContextClass)

Sets class to be used for the Hibernate CurrentSessionContext.

void setDataSourceName(java.lang.String name)

void setGrailsApplication(GrailsApplication grailsApplication)

@param grailsApplication The grailsApplication to set.

void setHibernateEventListeners(HibernateEventListeners listeners)

void setProxyIfReloadEnabled(boolean proxyIfReloadEnabled)

@param proxyIfReloadEnabled Sets whether a proxy should be created if reload is enabled

void setSessionFactoryBeanName(java.lang.String name)

 
Methods inherited from class org.springframework.orm.hibernate3.LocalSessionFactoryBean
org.springframework.orm.hibernate3.LocalSessionFactoryBean#destroy(), org.springframework.orm.hibernate3.LocalSessionFactoryBean#getConfiguration(), org.springframework.orm.hibernate3.LocalSessionFactoryBean#setEventListeners(java.util.Map), org.springframework.orm.hibernate3.LocalSessionFactoryBean#setNamingStrategy(org.hibernate.cfg.NamingStrategy), org.springframework.orm.hibernate3.LocalSessionFactoryBean#setBeanClassLoader(java.lang.ClassLoader), org.springframework.orm.hibernate3.LocalSessionFactoryBean#setConfigLocation(org.springframework.core.io.Resource), org.springframework.orm.hibernate3.LocalSessionFactoryBean#setConfigLocations([Lorg.springframework.core.io.Resource;), org.springframework.orm.hibernate3.LocalSessionFactoryBean#setEntityInterceptor(org.hibernate.Interceptor), org.springframework.orm.hibernate3.LocalSessionFactoryBean#getConfigTimeDataSource(), org.springframework.orm.hibernate3.LocalSessionFactoryBean#getConfigTimeTransactionManager(), org.springframework.orm.hibernate3.LocalSessionFactoryBean#getConfigTimeCacheProvider(), org.springframework.orm.hibernate3.LocalSessionFactoryBean#getConfigTimeLobHandler(), org.springframework.orm.hibernate3.LocalSessionFactoryBean#setConfigurationClass(java.lang.Class), org.springframework.orm.hibernate3.LocalSessionFactoryBean#setMappingResources([Ljava.lang.String;), org.springframework.orm.hibernate3.LocalSessionFactoryBean#setMappingLocations([Lorg.springframework.core.io.Resource;), org.springframework.orm.hibernate3.LocalSessionFactoryBean#setCacheableMappingLocations([Lorg.springframework.core.io.Resource;), org.springframework.orm.hibernate3.LocalSessionFactoryBean#setMappingJarLocations([Lorg.springframework.core.io.Resource;), org.springframework.orm.hibernate3.LocalSessionFactoryBean#setMappingDirectoryLocations([Lorg.springframework.core.io.Resource;), org.springframework.orm.hibernate3.LocalSessionFactoryBean#setHibernateProperties(java.util.Properties), org.springframework.orm.hibernate3.LocalSessionFactoryBean#getHibernateProperties(), org.springframework.orm.hibernate3.LocalSessionFactoryBean#setJtaTransactionManager(javax.transaction.TransactionManager), org.springframework.orm.hibernate3.LocalSessionFactoryBean#setCacheRegionFactory(java.lang.Object), org.springframework.orm.hibernate3.LocalSessionFactoryBean#setCacheProvider(org.hibernate.cache.CacheProvider), org.springframework.orm.hibernate3.LocalSessionFactoryBean#setLobHandler(org.springframework.jdbc.support.lob.LobHandler), org.springframework.orm.hibernate3.LocalSessionFactoryBean#setTypeDefinitions([Lorg.springframework.orm.hibernate3.TypeDefinitionBean;), org.springframework.orm.hibernate3.LocalSessionFactoryBean#setFilterDefinitions([Lorg.hibernate.engine.FilterDefinition;), org.springframework.orm.hibernate3.LocalSessionFactoryBean#setEntityCacheStrategies(java.util.Properties), org.springframework.orm.hibernate3.LocalSessionFactoryBean#setCollectionCacheStrategies(java.util.Properties), org.springframework.orm.hibernate3.LocalSessionFactoryBean#setSchemaUpdate(boolean), org.springframework.orm.hibernate3.LocalSessionFactoryBean#updateDatabaseSchema(), org.springframework.orm.hibernate3.LocalSessionFactoryBean#validateDatabaseSchema(), org.springframework.orm.hibernate3.LocalSessionFactoryBean#dropDatabaseSchema(), org.springframework.orm.hibernate3.LocalSessionFactoryBean#createDatabaseSchema(), org.springframework.orm.hibernate3.LocalSessionFactoryBean#getObject(), org.springframework.orm.hibernate3.LocalSessionFactoryBean#getObject(), org.springframework.orm.hibernate3.LocalSessionFactoryBean#getObjectType(), org.springframework.orm.hibernate3.LocalSessionFactoryBean#isSingleton(), org.springframework.orm.hibernate3.LocalSessionFactoryBean#afterPropertiesSet(), org.springframework.orm.hibernate3.LocalSessionFactoryBean#setDataSource(javax.sql.DataSource), org.springframework.orm.hibernate3.LocalSessionFactoryBean#getDataSource(), org.springframework.orm.hibernate3.LocalSessionFactoryBean#setUseTransactionAwareDataSource(boolean), org.springframework.orm.hibernate3.LocalSessionFactoryBean#setExposeTransactionAwareSessionFactory(boolean), org.springframework.orm.hibernate3.LocalSessionFactoryBean#setJdbcExceptionTranslator(org.springframework.jdbc.support.SQLExceptionTranslator), org.springframework.orm.hibernate3.LocalSessionFactoryBean#translateExceptionIfPossible(java.lang.RuntimeException), org.springframework.orm.hibernate3.LocalSessionFactoryBean#wait(), org.springframework.orm.hibernate3.LocalSessionFactoryBean#wait(long), org.springframework.orm.hibernate3.LocalSessionFactoryBean#wait(long, int), org.springframework.orm.hibernate3.LocalSessionFactoryBean#equals(java.lang.Object), org.springframework.orm.hibernate3.LocalSessionFactoryBean#toString(), org.springframework.orm.hibernate3.LocalSessionFactoryBean#hashCode(), org.springframework.orm.hibernate3.LocalSessionFactoryBean#getClass(), org.springframework.orm.hibernate3.LocalSessionFactoryBean#notify(), org.springframework.orm.hibernate3.LocalSessionFactoryBean#notifyAll()
 
Methods inherited from class org.springframework.orm.hibernate3.AbstractSessionFactoryBean
org.springframework.orm.hibernate3.AbstractSessionFactoryBean#getObject(), org.springframework.orm.hibernate3.AbstractSessionFactoryBean#getObject(), org.springframework.orm.hibernate3.AbstractSessionFactoryBean#destroy(), org.springframework.orm.hibernate3.AbstractSessionFactoryBean#getObjectType(), org.springframework.orm.hibernate3.AbstractSessionFactoryBean#isSingleton(), org.springframework.orm.hibernate3.AbstractSessionFactoryBean#afterPropertiesSet(), org.springframework.orm.hibernate3.AbstractSessionFactoryBean#setDataSource(javax.sql.DataSource), org.springframework.orm.hibernate3.AbstractSessionFactoryBean#getDataSource(), org.springframework.orm.hibernate3.AbstractSessionFactoryBean#setUseTransactionAwareDataSource(boolean), org.springframework.orm.hibernate3.AbstractSessionFactoryBean#setExposeTransactionAwareSessionFactory(boolean), org.springframework.orm.hibernate3.AbstractSessionFactoryBean#setJdbcExceptionTranslator(org.springframework.jdbc.support.SQLExceptionTranslator), org.springframework.orm.hibernate3.AbstractSessionFactoryBean#translateExceptionIfPossible(java.lang.RuntimeException), org.springframework.orm.hibernate3.AbstractSessionFactoryBean#wait(), org.springframework.orm.hibernate3.AbstractSessionFactoryBean#wait(long), org.springframework.orm.hibernate3.AbstractSessionFactoryBean#wait(long, int), org.springframework.orm.hibernate3.AbstractSessionFactoryBean#equals(java.lang.Object), org.springframework.orm.hibernate3.AbstractSessionFactoryBean#toString(), org.springframework.orm.hibernate3.AbstractSessionFactoryBean#hashCode(), org.springframework.orm.hibernate3.AbstractSessionFactoryBean#getClass(), org.springframework.orm.hibernate3.AbstractSessionFactoryBean#notify(), org.springframework.orm.hibernate3.AbstractSessionFactoryBean#notifyAll()
 

Field Detail

LOG

protected static final org.apache.commons.logging.Log LOG


applicationContext

protected org.springframework.context.ApplicationContext applicationContext


classLoader

protected java.lang.ClassLoader classLoader


configClass

protected java.lang.Class configClass


currentSessionContextClass

protected java.lang.Class currentSessionContextClass


dataSourceName

protected java.lang.String dataSourceName


grailsApplication

protected GrailsApplication grailsApplication


hibernateEventListeners

protected HibernateEventListeners hibernateEventListeners


proxyIfReloadEnabled

protected boolean proxyIfReloadEnabled


sessionFactoryBeanName

protected java.lang.String sessionFactoryBeanName


 
Method Detail

addNewListenerToConfiguration

Object newListener = newlistenerMap.get(listenerType);
protected void addNewListenerToConfiguration(org.hibernate.cfg.Configuration config, java.lang.String listenerType, java.lang.Class klass, java.lang.Object[] currentListeners, java.util.Map newlistenerMap)


afterPropertiesSet

Thread thread = Thread.currentThread();
public void afterPropertiesSet()


destroy

MetaClassRegistry registry = GroovySystem.getMetaClassRegistry();
public void destroy()


getCauseMessage

protected java.lang.String getCauseMessage(org.hibernate.HibernateException e)


getGrailsApplication

public GrailsApplication getGrailsApplication()
Returns:
Returns the grailsApplication.


isCacheConfigurationError

protected boolean isCacheConfigurationError(java.lang.Throwable cause)


newConfiguration

@Override
protected org.hibernate.cfg.Configuration newConfiguration()
Overrides default behaviour to allow for a configurable configuration class.


newSessionFactory

try {
protected org.hibernate.SessionFactory newSessionFactory(org.hibernate.cfg.Configuration configuration)


postProcessConfiguration

if (hibernateEventListeners != null && hibernateEventListeners.getListenerMap() != null) {
protected void postProcessConfiguration(org.hibernate.cfg.Configuration config)


setApplicationContext

public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)


setBeanClassLoader

classLoader = beanClassLoader;
public void setBeanClassLoader(java.lang.ClassLoader beanClassLoader)


setConfigClass

public void setConfigClass(java.lang.Class configClass)
Sets the class to be used for Hibernate Configuration.
Parameters:
configClass - A subclass of the Hibernate Configuration class


setCurrentSessionContextClass

public void setCurrentSessionContextClass(java.lang.Class currentSessionContextClass)
Sets class to be used for the Hibernate CurrentSessionContext.
Parameters:
currentSessionContextClass - An implementation of the CurrentSessionContext interface


setDataSourceName

public void setDataSourceName(java.lang.String name)


setGrailsApplication

public void setGrailsApplication(GrailsApplication grailsApplication)
Parameters:
grailsApplication - The grailsApplication to set.


setHibernateEventListeners

public void setHibernateEventListeners(HibernateEventListeners listeners)


setProxyIfReloadEnabled

public void setProxyIfReloadEnabled(boolean proxyIfReloadEnabled)
Parameters:
proxyIfReloadEnabled - Sets whether a proxy should be created if reload is enabled


setSessionFactoryBeanName

public void setSessionFactoryBeanName(java.lang.String name)


 

Groovy Documentation