Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring Boot+JPA+QueryDSL=OrderSpecifier not found

I have this pom.xml:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.3.5.RELEASE</version>
</parent>

<dependencies>
    <dependency>
        <groupId>com.mysema.querydsl</groupId>
        <artifactId>querydsl-jpa</artifactId>
    </dependency>
    <dependency>
        <groupId>com.mysema.querydsl</groupId>
        <artifactId>querydsl-apt</artifactId>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>

    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>1.6.1</version>
    </dependency>
    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <version>1.16.8</version>
    </dependency>
    <dependency>
        <groupId>org.hsqldb</groupId>
        <artifactId>hsqldb</artifactId>
        <scope>runtime</scope>
    </dependency>
</dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>com.mysema.maven</groupId>
                <artifactId>apt-maven-plugin</artifactId>
                <version>1.1.3</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>process</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>target/generated-sources/java</outputDirectory>
                            <processor>com.querydsl.apt.jpa.JPAAnnotationProcessor</processor>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

And this Entity:

@Entity
@Data
@Builder
public class DataDto {
    @Id
    private String id;
    private String name;
}

And this Repo:

public interface DataRepo extends  JpaRepository <DataDto,String>, QueryDslPredicateExecutor<DataDto> {
}

I get this error:

Error:(9, 8) java: cannot access com.mysema.query.types.OrderSpecifier
  class file for com.mysema.query.types.OrderSpecifier not found

It sounds like I'm missing a dependency or something??

I've been following these links to help: http://www.querydsl.com/static/querydsl/latest/reference/html/ch02.html#jpa_integration http://spring.io/blog/2011/04/26/advanced-spring-data-jpa-specifications-and-querydsl

like image 773
User1 Avatar asked Jun 10 '16 04:06

User1


1 Answers

Add following dependency in the project

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

Version number according to the your JPA version.

like image 159
Dhruv Bansal Avatar answered Oct 24 '22 01:10

Dhruv Bansal