框架搭建(六) Sprig與hibernate的整合

整合原理:將SessionFactory交給spring容器管理

在applicationContext.xml中配置

1.將SessionFactory配置到spring容器中去

<bean name="sessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean"> 

2.有兩種配置配置方式

①,仍然使用hibernate.cfg.xml配置信息

②在spring配置中放置hibernate的配置信息(推薦)

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章