Hibernate Local Session Factory Bean

less than 1 minute read


http://static.springframework.org/spring/docs/1.2.x/api/index.html

http://static.springframework.org/spring/docs/1.2.x/api/org/springframework/orm/hibernate/LocalSessionFactoryBean.html

void     setMappingDirectoryLocations(Resource[] mappingDirectoryLocations)
          Set locations of directories that contain Hibernate mapping resources, like "WEB-INF/mappings".    
 void     setMappingJarLocations(Resource[] mappingJarLocations)
          Set locations of jar files that contain Hibernate mapping resources, like "WEB-INF/lib/example.hbm.jar".    
 void     setMappingLocations(Resource[] mappingLocations)
          Set locations of Hibernate mapping files, for example as classpath resource "classpath:example.hbm.xml".    
 void     setMappingResources(String[] mappingResources)
          Set Hibernate mapping resources to be found in the class path, like " example.hbm.xml" or "mypackage/example.hbm.xml".    


    <bean id="sessionFactory" class="org.springframework.orm.hibernate.LocalSessionFactoryBean" init-method="createDatabaseSchema">
        <property name="dataSource">
            <ref bean="dataSource"/>
        </property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">net.sf.hibernate.dialect.HSQLDialect</prop>
                <prop key="hibernate.show_sql">false</prop>
            </props>
        </property>
        <!–
        <property name="mappingResources">
          <list>
            <value>C:\norkom_home\Ref2_Template_Tag_1.0.0.5\conf\hibernate.cfg.xml</value>
          </list>
        </property>
        –>
        <property name="mappingLocations">
              <list>
                  <value>classpath:com/norkom/base//*.hbm.xml</value>
                  <value>classpath*:com/norkom/wlm/
/
.hbm.xml</value>
                  <!–
                  <value>classpath:com/norkom/cm//*.hbm.xml</value>
                  <value>classpath*:com/norkom/configurator/
/
.hbm.xml</value>
                  –>
              </list>
        </property>
        
    </bean>

Categories:

Updated:

Leave a Comment