java.lang.NoSuchMethodError: org.hibernate.Session.createQuery(Ljava/lang/String;)Lorg/hibernate/query/Query;

Spring JIRA | St├ęphane Nicoll | 5 months ago
  1. 0

    Does not work with Hibernate 5.2

    GitHub | 6 months ago | johnjaylward
    java.lang.NoSuchMethodError: org.hibernate.Session.createQuery(Ljava/lang/String;)Lorg/hibernate/Query;
  2. 0

    https://github.com/spring-projects/spring-framework/blob/master/spring-orm/src/main/java/org/springframework/orm/hibernate5/HibernateTemplate.java#L958 attempts to be compatible with Hibernate 5.x, but because it's compiled against 5.2, the compiler then requires that the runtime method return a org.hibernate.query.Query instance, and thus when running with standard Spring Boot 1.4 versions, you get: {code} java.lang.NoSuchMethodError: org.hibernate.Session.getNamedQuery(Ljava/lang/String;)Lorg/hibernate/query/Query; at org.springframework.orm.hibernate5.HibernateTemplate$32.doInHibernate(HibernateTemplate.java:958) at org.springframework.orm.hibernate5.HibernateTemplate$32.doInHibernate(HibernateTemplate.java:954) at org.springframework.orm.hibernate5.HibernateTemplate.doExecute(HibernateTemplate.java:356) at org.springframework.orm.hibernate5.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:323) at org.springframework.orm.hibernate5.HibernateTemplate.findByNamedQuery(HibernateTemplate.java:954) at example.HibernateTemplateBugTest.testFindByNamedQuery(HibernateTemplateBugTest.java:28) {code} in the attached reproduction test when run with simply {code} mvn clean test {code} If however, you override the standard Hibernate version to 5.2.2 then the test succeeds by running {code} mvn -Dhibernate.version=5.2.2.Final clean test {code}

    Spring JIRA | 3 months ago | Steve Storey
    java.lang.NoSuchMethodError: org.hibernate.Session.getNamedQuery(Ljava/lang/String;)Lorg/hibernate/query/Query;
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    How to setup PostGIS JDBC with Hibernate?

    Geographic Information Systems | 4 years ago | I. Gona
    java.lang.NoSuchMethodError: org.hibernate.type.CustomType.<init>(Lorg/hibernate/usertype/UserType;[Ljava/lang/String;)V
  5. 0

    [SPR-13391] Compatibility with Hibernate ORM 5.0 Final - create instance of entityManagerFactory - Spring JIRA

    spring.io | 11 months ago
    java.lang.NoSuchMethodError: org.hibernate.property.access.spi.PropertyAccessStrategyResolver.resolvePropertyAccessStrategy(Ljava/lang/String;Lorg/hibernate/EntityMode;)Lorg/hibernate/property/access/spi/PropertyAccessStrategy;

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.NoSuchMethodError

      org.hibernate.Session.createQuery(Ljava/lang/String;)Lorg/hibernate/query/Query;

      at org.springframework.orm.hibernate5.HibernateTemplate$38.doInHibernate()
    2. org.springframework.orm
      HibernateTemplate.bulkUpdate
      1. org.springframework.orm.hibernate5.HibernateTemplate$38.doInHibernate(HibernateTemplate.java:1103)
      2. org.springframework.orm.hibernate5.HibernateTemplate$38.doInHibernate(HibernateTemplate.java:1099)
      3. org.springframework.orm.hibernate5.HibernateTemplate.doExecute(HibernateTemplate.java:340)
      4. org.springframework.orm.hibernate5.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:307)
      5. org.springframework.orm.hibernate5.HibernateTemplate.bulkUpdate(HibernateTemplate.java:1099)
      5 frames