HibernateTemplate vs SessionFactory

前端 未结 1 1169
天命终不由人
天命终不由人 2021-02-10 09:05

Maybe someone could explain which one to use? When and why?

1条回答
  •  臣服心动
    2021-02-10 09:51

    The javadoc of HibernateTemplate says:

    NOTE: As of Hibernate 3.0.1, transactional Hibernate access code can also be coded in plain Hibernate style. Hence, for newly started projects, consider adopting the standard Hibernate3 style of coding data access objects instead, based on SessionFactory.getCurrentSession().

    So even Spring tells you not to use Spring's HibernateTemplate anymore. And there is no HibernateTemplate for Hibernate4. The choice should be obvious.

    0 讨论(0)
提交回复
热议问题