Reputation: 71
my DAO code:
public class UserDaoImpl extends HibernateDaoSupport implements UserDao {
public List<User> findAll() {
return (List<User>) this.getHibernateTemplate().find("from User");
}
}
when i run it lead a error like this:
java.lang.NoSuchMethodError: org.hibernate.Session.createQuery(Ljava/lang/String;)Lorg/hibernate/Query;
at org.springframework.orm.hibernate5.HibernateTemplate$29.doInHibernate(HibernateTemplate.java:866)
at org.springframework.orm.hibernate5.HibernateTemplate$29.doInHibernate(HibernateTemplate.java:863)
what should i do to correct this error?
Upvotes: 2
Views: 556
Reputation: 11077
Seems something to with the compatibility of spring and hibernate spring 4.2.x is not going well with hibernate version greater than. 5.1.x
change your version
<hibernate.version>5.1.0.Final</hibernate.version>
which should allow you to work with your current spring version.
Probably you should log ticket in spring jira as well.
Check : spring-orm-4.2.6 incompatible to hibernate-orm-5.2.0 and SPR-14327
Upvotes: 2