org.codehaus.groovy.grails.orm.hibernate
Class ConfigurableLocalSessionFactoryBean

java.lang.Object
  extended by org.springframework.orm.hibernate3.AbstractSessionFactoryBean
      extended by org.springframework.orm.hibernate3.LocalSessionFactoryBean
          extended by org.codehaus.groovy.grails.orm.hibernate.ConfigurableLocalSessionFactoryBean
All Implemented Interfaces:
BeanClassLoaderAware, DisposableBean, FactoryBean<org.hibernate.SessionFactory>, InitializingBean, ApplicationContextAware, PersistenceExceptionTranslator

public class ConfigurableLocalSessionFactoryBean
extends LocalSessionFactoryBean
implements ApplicationContextAware

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

Since:
07-Jul-2005
Author:
Graeme Rocher

Field Summary
 
Fields inherited from class org.springframework.orm.hibernate3.AbstractSessionFactoryBean
logger
 
Constructor Summary
ConfigurableLocalSessionFactoryBean()
           
 
Method Summary
 void destroy()
           
 GrailsApplication getGrailsApplication()
           
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 config)
           
 void setApplicationContext(ApplicationContext applicationContext)
           
 void setClassLoader(ClassLoader classLoader)
           
 void setConfigClass(Class configClass)
          Sets the class to be used for Hibernate Configuration
 void setCurrentSessionContextClass(Class currentSessionContextClass)
          Sets class to be used for the Hibernate CurrentSessionContext
 void setGrailsApplication(GrailsApplication grailsApplication)
           
 
Methods inherited from class org.springframework.orm.hibernate3.LocalSessionFactoryBean
afterSessionFactoryCreation, buildSessionFactory, createDatabaseSchema, dropDatabaseSchema, executeSchemaScript, executeSchemaStatement, getConfigTimeCacheProvider, getConfigTimeDataSource, getConfigTimeLobHandler, getConfigTimeTransactionManager, getConfiguration, getHibernateProperties, postProcessConfiguration, postProcessMappings, setBeanClassLoader, setCacheableMappingLocations, setCacheProvider, setCacheRegionFactory, setCollectionCacheStrategies, setConfigLocation, setConfigLocations, setConfigurationClass, setEntityCacheStrategies, setEntityInterceptor, setEventListeners, setFilterDefinitions, setHibernateProperties, setJtaTransactionManager, setLobHandler, setMappingDirectoryLocations, setMappingJarLocations, setMappingLocations, setMappingResources, setNamingStrategy, setSchemaUpdate, setTypeDefinitions, updateDatabaseSchema, validateDatabaseSchema
 
Methods inherited from class org.springframework.orm.hibernate3.AbstractSessionFactoryBean
afterPropertiesSet, beforeSessionFactoryDestruction, convertHibernateAccessException, getDataSource, getObject, getObjectType, getSessionFactory, isExposeTransactionAwareSessionFactory, isSingleton, isUseTransactionAwareDataSource, setDataSource, setExposeTransactionAwareSessionFactory, setJdbcExceptionTranslator, setUseTransactionAwareDataSource, translateExceptionIfPossible, wrapSessionFactoryIfNecessary
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfigurableLocalSessionFactoryBean

public ConfigurableLocalSessionFactoryBean()
Method Detail

setCurrentSessionContextClass

public void setCurrentSessionContextClass(Class currentSessionContextClass)
Sets class to be used for the Hibernate CurrentSessionContext

Parameters:
currentSessionContextClass - An implementation of the CurrentSessionContext interface

setConfigClass

public void setConfigClass(Class configClass)
Sets the class to be used for Hibernate Configuration

Parameters:
configClass - A subclass of the Hibernate Configuration class

getGrailsApplication

public GrailsApplication getGrailsApplication()
Returns:
Returns the grailsApplication.

setGrailsApplication

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

newConfiguration

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

Overrides:
newConfiguration in class LocalSessionFactoryBean

setClassLoader

public void setClassLoader(ClassLoader classLoader)

newSessionFactory

protected org.hibernate.SessionFactory newSessionFactory(org.hibernate.cfg.Configuration config)
                                                  throws org.hibernate.HibernateException
Overrides:
newSessionFactory in class LocalSessionFactoryBean
Throws:
org.hibernate.HibernateException

setApplicationContext

public void setApplicationContext(ApplicationContext applicationContext)
                           throws BeansException
Specified by:
setApplicationContext in interface ApplicationContextAware
Throws:
BeansException

destroy

public void destroy()
             throws org.hibernate.HibernateException
Specified by:
destroy in interface DisposableBean
Overrides:
destroy in class LocalSessionFactoryBean
Throws:
org.hibernate.HibernateException


Copyright (c) 2005-2009 The Grails project