简体   繁体   中英

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM