TA的每日心情 | 开心 2021-3-12 23:18 |
---|
签到天数: 2 天 [LV.1]初来乍到
|
<!-- Spring中配置集成Hibernate(XML配置实体) -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean" destroy-method="destroy"> <!-- SessionFactory配置 -->
<property name="dataSource" ref="dataSource"></property> <!-- 设置数据源 -->
<property name="mappingResources">
<list>
<value>classpath:/com/zhangjie/spring/orm/Cat.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties"> <!-- Hibernate属性 -->
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>
<prop key="hibernate.show_sql">true</prop> <!--输出SQL语句 -->
<prop key="hibernate.format_sql">false</prop> <!--格式化SQL语句 -->
<prop key="hibernate.hbm2ddl.auto">update</prop> <!--更新表结构 -->
<prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop> <!-- 缓存实现类 -->
<prop key="hibernate.cache.use_query_cache">true</prop> <!-- 使用查询缓存 -->
</props>
</property>
</bean>
<!-- 将sessionFactory使用到Dao中 -->
<bean id="catDao" class="com.zhangjie.spring.orm.CatDaoImpl"> <!-- Dao对象 -->
<property name="sessionFactory" ref="sessionFactory"></property> <!-- 设置SessionFactory -->
</bean>
|
|