类 SessionFactoryBean
- java.lang.Object
-
- org.beangle.orm.hibernate.SessionFactoryBean
-
- 所有已实现的接口:
Disposable,Initializing,org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanClassLoaderAware,org.springframework.beans.factory.FactoryBean<org.hibernate.SessionFactory>
public class SessionFactoryBean extends Object implements org.springframework.beans.factory.FactoryBean<org.hibernate.SessionFactory>, Initializing, Disposable, org.springframework.beans.factory.BeanClassLoaderAware
- 版本:
- $Id: SessionFactoryBean.java Feb 27, 2012 10:52:27 PM chaostone $
- 作者:
- chaostone
-
-
字段概要
字段 修饰符和类型 字段 说明 protected org.slf4j.Loggerlogger
-
构造器概要
构造器 构造器 说明 SessionFactoryBean()
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 voiddestroy()org.hibernate.cfg.ConfigurationgetConfiguration()DataSourcegetDataSource()PropertiesgetHibernateProperties()Return the Hibernate properties, if any.org.hibernate.SessionFactorygetObject()Class<? extends org.hibernate.SessionFactory>getObjectType()org.hibernate.SessionFactorygetSessionFactory()voidinit()booleanisSingleton()protected org.hibernate.cfg.ConfigurationnewConfiguration()Subclasses can override this method to perform custom initialization of the Configuration instance used for SessionFactory creation.protected voidprocessProperties()voidsetBeanClassLoader(ClassLoader classLoader)voidsetConfigLocations(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".voidsetConfigurationClass(Class<? extends org.hibernate.cfg.Configuration> configurationClass)voidsetDataSource(DataSource dataSource)voidsetHibernateProperties(Properties hibernateProperties)Set Hibernate properties, such as "hibernate.dialect".voidsetNamingStrategy(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.voidsetPersistLocations(org.springframework.core.io.Resource[] persistLocations)voidsetStaticHbm(org.springframework.core.io.Resource staticHbm)
-
-
-
方法详细资料
-
setConfigLocations
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".Note: Can be omitted when all necessary properties and mapping resources are specified locally via this bean.
- 另请参阅:
Configuration.configure(java.net.URL)
-
setPersistLocations
public void setPersistLocations(org.springframework.core.io.Resource[] persistLocations)
-
setHibernateProperties
public void setHibernateProperties(Properties hibernateProperties)
Set Hibernate properties, such as "hibernate.dialect".Can be used to override values in a Hibernate XML config file, or to specify all necessary properties locally.
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.
-
getHibernateProperties
public Properties getHibernateProperties()
Return the Hibernate properties, if any. Mainly available for configuration through property paths that specify individual keys.
-
setNamingStrategy
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.- 另请参阅:
Configuration.setNamingStrategy(org.hibernate.cfg.NamingStrategy)
-
processProperties
protected void processProperties()
-
init
public void init() throws Exception- 指定者:
init在接口中Initializing- 抛出:
Exception
-
newConfiguration
protected org.hibernate.cfg.Configuration newConfiguration() throws org.hibernate.HibernateExceptionSubclasses can override this method to perform custom initialization of the Configuration instance used for SessionFactory creation. The properties of this LocalSessionFactoryBean will be applied to the Configuration object that gets returned here.The default implementation creates a new Configuration instance. A custom implementation could prepare the instance in a specific way, or use a custom Configuration subclass.
- 返回:
- the Configuration instance
- 抛出:
org.hibernate.HibernateException- in case of Hibernate initialization errors- 另请参阅:
Configuration()
-
destroy
public void destroy() throws org.hibernate.HibernateException- 指定者:
destroy在接口中Disposable- 抛出:
org.hibernate.HibernateException
-
setBeanClassLoader
public void setBeanClassLoader(ClassLoader classLoader)
- 指定者:
setBeanClassLoader在接口中org.springframework.beans.factory.BeanClassLoaderAware
-
getObject
public org.hibernate.SessionFactory getObject()
- 指定者:
getObject在接口中org.springframework.beans.factory.FactoryBean<org.hibernate.SessionFactory>
-
getObjectType
public Class<? extends org.hibernate.SessionFactory> getObjectType()
- 指定者:
getObjectType在接口中org.springframework.beans.factory.FactoryBean<org.hibernate.SessionFactory>
-
isSingleton
public boolean isSingleton()
- 指定者:
isSingleton在接口中org.springframework.beans.factory.FactoryBean<org.hibernate.SessionFactory>
-
getDataSource
public DataSource getDataSource()
-
setDataSource
public void setDataSource(DataSource dataSource)
-
getSessionFactory
public org.hibernate.SessionFactory getSessionFactory()
-
setConfigurationClass
public void setConfigurationClass(Class<? extends org.hibernate.cfg.Configuration> configurationClass)
-
getConfiguration
public org.hibernate.cfg.Configuration getConfiguration()
-
setStaticHbm
public void setStaticHbm(org.springframework.core.io.Resource staticHbm)
-
-