HibernateTemplate vs HibernateDaoSupport vs SessionFactory Injection

后端 未结 3 1910
既然无缘
既然无缘 2021-02-03 15:27

I have seen in lot of forums and still in confusion. We are starting a new project with Spring 3.1 & Hibernate 4 and need to decide which strategy to use for Hibernate with

3条回答
  •  情话喂你
    2021-02-03 16:11

    Spring itself recommends not using HibernateTemplate anymore, in the javadoc of the class. You can declare the session factory as a Spring bean directly, inject it as any other Spring bean in your own components, and use the native Hibernate API directly (using sessionFactory.getCurrentSession()).

提交回复
热议问题