Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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;
like image 213
Etantonio Avatar asked May 22 '16 11:05

Etantonio


2 Answers

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.

like image 168
Peter Avatar answered Sep 28 '22 08:09

Peter


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.

like image 43
David Magalhães Avatar answered Sep 28 '22 10:09

David Magalhães