I'm trying to use QDataTableRepository in my project. It makes me must import querydsl.
build.gradle
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'idea'
repositories {
mavenCentral()
}
dependencies {
compile("org.springframework.boot:spring-boot-devtools")
compile('org.springframework.boot:spring-boot-starter')
compile('org.springframework.boot:spring-boot-starter-web')
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile('org.postgresql:postgresql:9.4.1212')
compile('org.projectlombok:lombok:1.16.10')
compile group: 'com.github.darrachequesne', name: 'spring-data-jpa-datatables', version: '3.1'
compile group: 'com.querydsl', name: 'querydsl-jpa', version: '4.1.4'
compile group: 'com.querydsl', name: 'querydsl-apt', version: '4.1.4'
testCompile('org.springframework.boot:spring-boot-starter-test')
}
configurations {
querydslapt
}
sourceSets {
generated
}
sourceSets.generated.java.srcDirs = ['generated/']
task generateQueryDSL(type: JavaCompile, group: 'build', description: 'Generates the QueryDSL query types') {
source = sourceSets.main.java
classpath = configurations.compile + configurations.querydslapt
options.compilerArgs = [
"-proc:only",
"-processor", "com.mysema.query.apt.jpa.JPAAnnotationProcessor"
]
destinationDir = sourceSets.generated.java.srcDirs.iterator().next()
}
compileGeneratedJava {
dependsOn generateQueryDSL
classpath += sourceSets.main.runtimeClasspath
}
And I also setting Annotation Processor in Intellij.
Picture of Annotation Processor setting
I build my project and build successful. The QClass generate inside.
Here
/**
* QClient is a Querydsl query type for Client
*/
@Generated("com.mysema.query.codegen.EntitySerializer")
public class QClient extends EntityPathBase<Client> {
But when I run the project the error .
Caused by: java.lang.IllegalArgumentException: Did not find a query class com.project.module.client.QClient for domain class om.project.module.client.Client!
Did I missing the configuration?