-
1. Re: WildFly 13: java.lang.NoSuchMethodError: org.hibernate.Session.createSQLQuery(Ljava/lang/String;)Lorg/hibernate/SQLQuery
andey May 18, 2018 12:45 PM (in response to erick.de.oliveira.leal)You may need to compile both projects using the same Hibernate version.
Why java.lang.NoSuchMethodError occurs in your case: createSQLQuery is defined slightly differently in 4.x (http://docs.jboss.org/hibernate/orm/4.3/javadocs/org/hibernate/SharedSessionContract.html) and 5.x (http://docs.jboss.org/hibernate/orm/5.2/javadocs/org/hibernate/query/QueryProducer.html). Note the return type is different.
At compile time, the method call is resolved correctly if either version is used. This is because the return type used by 5.x (NativeQuery) extends the one used by 4.x (SQLQuery). However, its is compiled with 4.x, it refers to createSQLQuery defined by 4.x (SQLQuery createSQLQuery(String)) and that can't be found in 5.x, that you use at runtime.
-
2. Re: WildFly 13: java.lang.NoSuchMethodError: org.hibernate.Session.createSQLQuery(Ljava/lang/String;)Lorg/hibernate/SQLQuery
erick.de.oliveira.leal May 19, 2018 9:48 AM (in response to andey)Both projects If i only have one? You just copied a answer from stackoverflow without read my question.
I dont see where Im using different versions. Its all JPA 2.2. can you help me? The pom is attached
-
3. Re: WildFly 13: java.lang.NoSuchMethodError: org.hibernate.Session.createSQLQuery(Ljava/lang/String;)Lorg/hibernate/SQLQuery
erick.de.oliveira.leal May 19, 2018 11:48 AM (in response to erick.de.oliveira.leal)Ok, I solved by adding version to my pom.xml.
-
pom.xml.zip 1.7 KB
-