querydsl-jpa 3.7.3 error when used with spring-data-jpa 1.10.0

15,510

Solution 1

Instead of

<dependency>
    <groupId>com.mysema.querydsl</groupId>
    <artifactId>querydsl-*</artifactId>
    <version>3.7.3</version>
</dependency>

you should use now

<dependency>
    <groupId>com.querydsl</groupId>
    <artifactId>querydsl-*</artifactId>
    <version>4.1.3</version>
</dependency>

The packages inside the jar files also have been changed so you have to change imported querydsl classes in your source code.

Solution 2

You should update the version of your querydsl to 4.1. Note that the groupId also have changed.

In here you can see that the 1.10.1.RELEASE uses the 4.1 of querydsl and that could be interfering with you using an old version.

Share:
15,510
Etantonio
Author by

Etantonio

Updated on June 18, 2022

Comments

  • Etantonio
    Etantonio almost 2 years

    I'm using

    <groupId>com.mysema.querydsl</groupId>
    <artifactId>querydsl-jpa</artifactId>
    <version>3.7.3</version>
    

    no problem with

    <groupId>org.springframework.data</groupId>
    <artifactId>spring-data-jpa</artifactId>
    <version>1.9.4.RELEASE</version>
    

    instead using

    <groupId>org.springframework.data</groupId>
    <artifactId>spring-data-jpa</artifactId>
    <version>1.10.1.RELEASE</version>
    

    on the same code I've the following errors:

    [ERROR] /C:/Prj/Java/Eclipse/Elfolab/src/main/java/com/interlabsrl/elfolab/persistence/multiple/repository/elettroforesi/springdatajpa/LinguaRepository.java:[13,8] cannot access com.querydsl.core.types.OrderSpecifier
      class file for com.querydsl.core.types.OrderSpecifier not found
    [ERROR] /C:/Prj/Java/Eclipse/Elfolab/src/main/java/com/interlabsrl/elfolab/controller/ricercaPaziente/RicercaPazienteController.java:[487,33] cannot access com.querydsl.core.types.Predicate
      class file for com.querydsl.core.types.Predicate not found
    [ERROR] /C:/Prj/Java/Eclipse/Elfolab/src/main/java/com/interlabsrl/elfolab/controller/ricercaArchivio/RicercaArchivioController.java:[74,32] no suitable constructor found for QSort(com.mysema.query.types.OrderSpecifier<java.util.Date>)
        constructor org.springframework.data.querydsl.QSort.QSort(com.querydsl.core.types.OrderSpecifier<?>...) is not applicable
          (varargs mismatch; com.mysema.query.types.OrderSpecifier<java.util.Date> cannot be converted to com.querydsl.core.types.OrderSpecifier<?>)
        constructor org.springframework.data.querydsl.QSort.QSort(java.util.List<com.querydsl.core.types.OrderSpecifier<?>>) is not applicable
          (argument mismatch; com.mysema.query.types.OrderSpecifier<java.util.Date> cannot be converted to java.util.List<com.querydsl.core.types.OrderSpecifier<?>>)
    [ERROR] /C:/Prj/Java/Eclipse/Elfolab/src/main/java/com/interlabsrl/elfolab/controller/ricercaArchivio/RicercaArchivioController.java:[611,31] no suitable constructor found for QSort(com.mysema.query.types.OrderSpecifier<java.lang.String>)
        constructor org.springframework.data.querydsl.QSort.QSort(com.querydsl.core.types.OrderSpecifier<?>...) is not applicable
          (varargs mismatch; com.mysema.query.types.OrderSpecifier<java.lang.String> cannot be converted to com.querydsl.core.types.OrderSpecifier<?>)
        constructor org.springframework.data.querydsl.QSort.QSort(java.util.List<com.querydsl.core.types.OrderSpecifier<?>>) is not applicable
          (argument mismatch; com.mysema.query.types.OrderSpecifier<java.lang.String> cannot be converted to java.util.List<com.querydsl.core.types.OrderSpecifier<?>>)
    

    Any idea about what's wrong between these versions?

    EDIT:

    Using

        <dependency>
            <groupId>com.querydsl</groupId>
            <artifactId>querydsl-jpa</artifactId>
            <version>4.1.0</version>
        </dependency>   
    

    i still have these errors:

    C:\Prj\Java\Eclipse\Elfolab\src\main\java\com\interlabsrl\elfolab\persistence\multiple\repository\elettroforesi\table\custom\impl\MetodicaRepositoryImpl.java:11: error: package com.mysema.query.jpa.impl does not exist
    import com.mysema.query.jpa.impl.JPAQuery;