类 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
    • 字段详细资料

      • logger

        protected org.slf4j.Logger logger
    • 构造器详细资料

      • SessionFactoryBean

        public SessionFactoryBean()
    • 方法详细资料

      • 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.

        另请参阅:
        setDataSource(javax.sql.DataSource)
      • 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()
      • newConfiguration

        protected org.hibernate.cfg.Configuration newConfiguration()
                                                            throws org.hibernate.HibernateException
        Subclasses 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)