spume
spume

Reputation: 2004

Spring 3.1 + Hibernate 4 - HibernateTemplate

Spring's hibernate4 package appears to have done away with HibernateTemplate and HibernateDaoSupport. I'm in the process of upgrading Hibernate from 3 to 4 in my Spring app and I have a fair few subclasses of Spring's HibernateDaoSupport and a couple of Hibernate callbacks through HibernateTemplate. Perhaps I'm not using the right search terms, but I can't find any info in the reference docs on how I should be refactoring these to "use plain hibernate daos as explained in the reference guide". Can anyone help point me in the right direction?

Upvotes: 14

Views: 19272

Answers (1)

JB Nizet
JB Nizet

Reputation: 691685

The javadoc of HibernateTemplate explains it. You should use sessionFactory.getCurrentSession() to get a session, and use the native Hibernate Session API directly.

Upvotes: 21

Related Questions