spring与hibernate整合配置非常灵活:
1、在applicationContext.xml中引入hibernate.cfg.xml,如下:<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<!-- 使用hibernate自身的配置文件配置
<property name="configLocations">
<list>
<value>classpath:cn/itcast/spring/hibernate/hibernate.cfg.xml</value>
</list>
</property>
</bean>
2、将hibernate相关配置配在applicationContext.xml中
<!-- 本地会话工厂bean,spring整合hibernate的核心接口 -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<!-- 指定hibernate自身的属性 -->
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
<prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>
</props>
</property>
<!-- 从指定目录下查找映射文件-->
<property name="mappingDirectoryLocations">
<list>
<value>cn/itcast/spring/domain</value>
</list>
</property>
<!-- 映射文件的位置
<property name="mappingResources">
<list>
<value>cn/itcast/spring/domain/Customer.hbm.xml</value>
</list>
</property>
-->
</bean>
分享到:
相关推荐
webwork Spring hibernate整合配置.doc
使用mysql数据库的struts2 spring hibernate整合简单示例,也可参考我的:“struts2 spring hibernate整合要点、注意点”这篇文档来配置
struts2 spring hibernate 整合: 三者整合通过查询oracle数据库中的用户登录界面,最简单的配置。 struts.xml web.xml application.xml怎样配置,怎样依赖注入才能实现整合,显示出页面?请看这篇文档
spring与hibernate的整合 spring事务的配置
12.6.16 编写Spring和Hibernate的配置文件spring-config.xml 12.6.17 编写web.xml 12.6.18 验证示例 12.7 小结 第四篇 J2EE项目案例精选 第十三章 网上调查系统 13.1 系统概述 13.2 需求分析 13.2.1 系统用例图 ...
Flex+Spring+Hibernate 整合的方式有多种,本文是利用flex builder插件,将flex与javaEE服务器端整合到一个工程里面,以便程序员可以在一个IDE里完成开发。
Struts2 Spring Hibernate的配置及登录实例的详细说明(附源码)
开发基于Struts Spring Hibernate Ajax整合配置文件的配置介绍。
spring和hibernate整合的优化配置.txt
spring整合struts2与hibernate核心配置文件
Spring Hibernate整合要点之JPA 1 依赖包 2 注解实体 3 DAO实现 4 JPA配置 5 spring配置 6 修改web.xml
struts+spring+hibernate配置笔记
有关Struts spring hibernate整合以及事务的处理和相关的配置,还有一些必要的代码。已经整理好了。
struts2 spring hibernate 整合的练习项目 发上来主要是为了以后能获得整合好的ssh工程,直接修改配置就能使用了。
hibernate与spring整合demohibernate与spring整合demo
Spring+Struts+Hibernate比较详细的整合配置方案
SSH(struts2,Hibernate,Spring)整合及测试亲测可用,百分之白亲测可用。
NULL 博文链接:https://8366.iteye.com/blog/412303
1 首先整合spring和hibernate,这次我们在spring 中配置bean使用注解的方式 ,hibernate实体映射关系也使用注解的方式,配置完毕后用简单方法测试下hibernate是否整合成功。 a 加入支持:添加 spring核心包、...
<param-value>/WEB-INF/spring/*.bean.xml org.springframework.web.context.ContextLoaderListener <listener> <listener-class>org.springframework.web.context.request....