Which queryDSL to use?

392 views
Skip to first unread message

Al Grant

unread,
Nov 3, 2017, 7:46:02 AM11/3/17
to Querydsl
Hello,

I am a complete newbie and just starting out to use queryDSL but can't even get as far as getting my Q classes generated.

I am using Spring-Boot 1.5.2
Hibernate
Intellij
Gradle

I am not even sure if I should be using:

com.querydsl or com.mysema.querydsl?

My build.gradle is outlined below:


buildscript {
ext {
springBootVersion = '1.5.2.RELEASE'
querydslVersion = '4.1.4'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
plugins {
id 'net.ltgt.apt' version '0.8'
id 'java'
}

ext["thymeleaf.version"] = "3.0.0.RELEASE"
ext["thymeleaf-layout-dialect.version"] = "2.0.1"

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'idea'

sourceSets {
generated
}
sourceSets.generated.java.srcDirs = ['src/main/generated']
configurations {
querydslapt
}

version = '0.0.5-SNAPSHOT'
sourceCompatibility = 1.8

repositories {
mavenCentral()
}
dependencies {

compile group: 'org.passay', name: 'passay', version: '1.3.0'

compile 'com.google.guava:guava:22.0'
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile('org.springframework.boot:spring-boot-starter-jdbc')
compile('org.springframework.boot:spring-boot-starter-thymeleaf')
compile('org.springframework.boot:spring-boot-starter-web')
compile('org.springframework.boot:spring-boot-starter-security')
compile('org.springframework.boot:spring-boot-starter-mail:1.5.7.RELEASE')
compile ("org.thymeleaf.extras:thymeleaf-extras-springsecurity4:3.0.0.RELEASE")
compile group: 'org.springframework.boot', name: 'spring-boot-starter-logging', version: '1.5.2.RELEASE'
compile group: 'org.thymeleaf.extras', name: 'thymeleaf-extras-springsecurity4', version: '2.1.2.RELEASE'
compile group: 'org.springframework.boot', name: 'spring-boot-autoconfigure', version: '1.5.2.RELEASE'
compile("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.4.0")

compile group: 'org.hibernate', name: 'hibernate-java8'
compile group: 'org.thymeleaf.extras', name: 'thymeleaf-extras-java8time', version: '3.0.0.RELEASE'

compile group: 'com.google.code.gson', name: 'gson', version: '2.8.1'
compile group: 'com.github.darrachequesne', name: 'spring-data-jpa-datatables', version: '4.1'

compile "com.querydsl:querydsl-root:$querydslVersion"
compile "com.querydsl:querydsl-jpa:$querydslVersion"
compile "com.querydsl:querydsl-apt:$querydslVersion:jpa"


compile group: 'org.mapstruct', name: 'mapstruct', version: '1.2.0.CR2'
apt 'org.mapstruct:mapstruct-processor:1.2.0.CR2'

// compile group: 'org.hibernate', name: 'hibernate-search-orm', version: '4.5.1.Final'

compile("org.springframework.boot:spring-boot-devtools")
compile('mysql:mysql-connector-java')
testCompile('org.hsqldb:hsqldb')
testCompile('org.springframework.boot:spring-boot-starter-test')
}
bootRun {
addResources = true
jvmArgs = ["-Dspring.output.ansi.enabled=ALWAYS"]
}




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.querydsl.apt.jpa.JPAAnnotationProcessor"
]
destinationDir = sourceSets.generated.java.srcDirs.iterator().next()
}

compileJava {
dependsOn generateQueryDSL
source generateQueryDSL.destinationDir
}

compileGeneratedJava {
dependsOn generateQueryDSL
classpath += sourceSets.main.runtimeClasspath
}

Ruben Dijkstra

unread,
Nov 3, 2017, 7:51:54 AM11/3/17
to Querydsl
Hello,

If you're just starting out, I'd recommend com.querydsl
That's Querydsl 4, and com.mysema.querydsl is Querydsl 3

However if one of the dependencies relies on just one version you can't pick so you'll have to find that out.

Best regards,
Ruben

Reply all
Reply to author
Forward
0 new messages