Paulius Matulionis
Paulius Matulionis

Reputation: 23415

HibernateTemplate vs SessionFactory

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

Upvotes: 4

Views: 5519

Answers (1)

JB Nizet
JB Nizet

Reputation: 691635

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.

Upvotes: 8

Related Questions