HibernateTemplate
unnecessarily ties your code to Spring classes. However according to document, since Hibernate 3.0.1 you don't need it any more - you can write a code against a plain Hibernate API while using Spring-managed transactions. All you need is to configure Spring transaction support, inject SessionFactory
and call getCurrentSession()
on it when you need to work with session.
Transaction
does all what HibernateTemplate
was doing and we do not need to depend upon Spring Class
, that is why it is eliminated from Spring 3.1.