spring-framework-3.2.4与hibernate-release-4.3.5下使用HibernateDaoSupport抛出异常

 spring-framework-3.2.4与hibernate-release-4.3.5下使用HibernateDaoSupport抛出异常java.lang.ClassCastException: org.springframework.orm.hibernate4.SessionHolder cannot be cast to org.springframework.orm.hibernate3.SessionHolder。



解决方案:



LZ打开spring的jar包后,发现org.springframework.orm.hibernate4.support中没有HibernateDaoSupport类。即用了hibernate4之后。不能再用HibernateDaoSupportHibernateTemplate类了
改用原生的hibernate语句
获得session:getSessionFactory().getCurrentSession()。


注:LZ是新手。仅仅为交流。如有不当之处。请指出。即使,扔板砖也能够。

原文地址:https://www.cnblogs.com/hrhguanli/p/5092985.html