hibernate接受spring管理

来源:百度知道 编辑:UC知道 时间:2024/07/04 19:34:19
在eclipse里添加hibernate选择Spring configuration file(applicationContext.xml)不明白什么意思,能不能具体讲讲

就是把在hibernate.cfg.xml中的配置文件在applicationContext.xml中配置,需要一个sessionFactory编号,用来创建SessionFactory,一个dataSource有来创建数据源。以后直接用getBean()就能获得,不需要HibernateSessionFactoryUtil类和hibernate.cfg.xml了,所有与hibernate有关的配置都可以在spring中的applicationContextmxml中配置。

推荐直接看配置文件,先不要用集成工具配置