Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HibernateTemplate class cast exception

I am gettin below error. I am using Spring 3.2.2 and Hibernate 4. How can I create a new HibernateTemplate object?

java.lang.ClassCastException: org.springframework.orm.hibernate4.SessionHolder cannot be cast to org.springframework.orm.hibernate3.SessionHolder 

I think this line gives error;

HibernateTemplate ht = new HibernateTemplate(sessionFactory); 
like image 815
hellzone Avatar asked Mar 22 '23 04:03

hellzone


1 Answers

Change your code from org.springframework.orm.hibernate3.HibernateTemplate to org.springframework.orm.hibernate4.HibernateTemplate in your DAO implementation class imported packages.

like image 138
Arun Prasath J Avatar answered Mar 31 '23 19:03

Arun Prasath J