querydsl: Hibernate 5.2 method signature incompatibilty
I tried out the latest Query DSL 4.1.2 and Hibernate 5.2, and hibernate appears to have changed method signatures.
java.lang.NoSuchMethodError: org.hibernate.Session.createQuery(Ljava/lang/String;)Lorg/hibernate/Query;
at com.querydsl.jpa.hibernate.DefaultSessionHolder.createQuery(DefaultSessionHolder.java:36)
at com.querydsl.jpa.hibernate.AbstractHibernateQuery.createQuery(AbstractHibernateQuery.java:104)
at com.querydsl.jpa.hibernate.AbstractHibernateQuery.createQuery(AbstractHibernateQuery.java:97)
at com.querydsl.jpa.hibernate.AbstractHibernateQuery.fetch(AbstractHibernateQuery.java:174)
The Query
class moved from org.hibernate
to org.hibernate.query
so the APIs don’t match anymore.
I’m sure there are more broken areas as well.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 35
- Comments: 67 (32 by maintainers)
Commits related to this issue
- upgraded to spring boot 2 dependencies added ignore to tests broken with latest hibernate due to querydsl incompatibility (https://github.com/querydsl/querydsl/issues/1917) — committed to infobip/infobip-spring-data-querydsl by lpandzic 6 years ago
- Spring data upgrade (#3) * upgraded to spring data 2 and hibernate 5.2.11 * added reference to querydsl issue * added spring milestone repository * testing * upgraded to latest milestone ... — committed to infobip/infobip-spring-data-querydsl by lpandzic 6 years ago
@FearlessHyena, yes, but Spring Data is the one that basically mandates Hibernate version and Spring Data 2.0.0.RELEASE is already out so this should be fixed ASAP. My advice is querydsl 4.2.0 for version number.
thanks for letting us know! I didn’t yet look at the roadmap for spring boot 2, so thanks for the news. I currently only can deploy Querydsl 4 artifacts but did hear from Timo, so will resolve the Querydsl 3 release problem. the fix is in the pipeline at least.
Just a heads up: Spring Boot 2.0.0 will come with Hibernate 5.2 as a minimum, effectively breaking QueryDSL support.
https://github.com/spring-projects/spring-boot/issues/7586
Edit: As pointed out by @johnjaylward : The relevant part of the referenced issue is this commit: https://github.com/spring-projects/spring-boot/commit/943262bb97dc95eb14f142bbc97fdbf6a6bfd4b4
Will make a push for Querydsl 5, which will include dependency updates. So will also open the PR for suggestions on what to change, since I’m not quite sure what Hibernate Validator versions are usable with which Hibernate versions, and someone was voicing concerns with hibernate-spatial dependency versions as well. Oh, and we’ll probably need to check compatibility with newer Guava versions, as well. 😕
@timowest, after seeing you’re active on several other issues, can you please shed some light on how this issue should/will be resolved? Spring Boot has been delayed to late February, but after it has been released a lot of users will hit this issue (since Spring Boot 2.0 transitively depends on Hibernate 5.2+).
Hibernate 5.2 should be named Hibernate 6 😉 I solved this in my project making an abstract class with two source-identical implementations, one compiled under 5.1 and one under 5.2, in 2 separate jars. Then I use an helper class, HibernateQuery compiled under 5.1 to load the right implementation depending on the environment and to expose the implementation statically. Last, all code that use the session to create a query must be changed to call the helper class. You can use the code if you want.
Any ETA on when QueryDSL would support Hibernate >= 5.2?
That’s great. Thank you for testing, it really helps us move forward with the remaining issues. Closing this for now.
Hi @Shredder121 , any update on querydsl compatibility with hibernate 5.2? We are really stuck for upgrading to spring boot 2. Thanks!
Huh. I think we’re both referring to different issues. I’m going to rename this issue, and could you add a new issue? (also I suppose if the query actually ran, the method invocation did occur, so this issue is fixed?)
@Shredder121 can we have an ETA when a fix for this might be available for 4.x?