(1)把hibernate的sessionFactory交给spring配置
(2)把hibernate数据库配置交给spring配置
一、导入jar包
1.spring基础jar包
2.hibernate基础jar包
3.spring中与hibernate整合有关的jar包
整合orm框架都需要这个jar包
二、编写实体类
三、配置实体类映射关系User.hbm.xml
四、配置hibernate核心配置文件hibernate.cfg.xml
此处的数据库配置放在了spring配置文件中,不在hibernate中配置。
五、配置spring配置文件
spring提供了sessionFactory的类,
六、结果
当服务器启动的时候