James
James

Reputation: 71

spring 4.2.4.RELEASE + hibernate 5.2.4.Final java.lang.NoSuchMethodError

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

Answers (1)

kuhajeyan
kuhajeyan

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

Related Questions