Pergunta

we are starting a new project and in a confusion whether we can use hibernatetemplates or not. But in many of forums found, use of hibernatetemplates is eliminated from spring 3.1+ on wards. Can any one please provide why hibernatetemplate was eliminated?

Foi útil?

Solução

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top