From e72b55c9ada7767ae20348b98ac664dd920b92ca Mon Sep 17 00:00:00 2001 From: jyjeong Date: Fri, 12 Apr 2019 09:58:10 +0900 Subject: [PATCH] kotlin-example QueryDsl Version Update --- gradle/kotlin-querydsl/build.gradle | 4 ++-- .../java/ru/trylogic/querydsl/example/Test.kt | 17 +++++------------ 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/gradle/kotlin-querydsl/build.gradle b/gradle/kotlin-querydsl/build.gradle index 10b59750c1..6d6827d446 100755 --- a/gradle/kotlin-querydsl/build.gradle +++ b/gradle/kotlin-querydsl/build.gradle @@ -16,8 +16,8 @@ apply plugin: 'kotlin-kapt' apply plugin: 'idea' dependencies { - compile "com.mysema.querydsl:querydsl-jpa:3.6.3" - kapt "com.mysema.querydsl:querydsl-apt:3.6.3:jpa" // Magic happens here + compile "com.querydsl:querydsl-jpa:4.2.1" + kapt "com.querydsl:querydsl-apt:4.2.1:jpa" // Magic happens here compile "org.hibernate:hibernate-entitymanager:4.3.5.Final" diff --git a/gradle/kotlin-querydsl/src/main/java/ru/trylogic/querydsl/example/Test.kt b/gradle/kotlin-querydsl/src/main/java/ru/trylogic/querydsl/example/Test.kt index ad76dd52bf..e77321c56f 100755 --- a/gradle/kotlin-querydsl/src/main/java/ru/trylogic/querydsl/example/Test.kt +++ b/gradle/kotlin-querydsl/src/main/java/ru/trylogic/querydsl/example/Test.kt @@ -1,18 +1,10 @@ package ru.trylogic.querydsl.example -import com.mysema.query.jpa.impl.JPAQuery -import org.hibernate.Hibernate -import org.hibernate.SessionFactory -import org.hibernate.cfg.Configuration -import org.hibernate.cfg.Environment - +import com.querydsl.jpa.impl.JPAQuery +import ru.trylogic.querydsl.example.QUser.user import javax.persistence.EntityManager import javax.persistence.EntityManagerFactory -import javax.persistence.EntityTransaction import javax.persistence.Persistence -import java.util.HashMap - -import ru.trylogic.querydsl.example.QUser.user object Test { @JvmStatic @@ -33,12 +25,13 @@ object Test { transaction.commit() - val query = JPAQuery(entityManager) + val query = JPAQuery(entityManager) val uniqueUserNames = query.from(user) .where(user.name.like("%ov")) .groupBy(user.name) - .list(user.name) + .select(user.name) + .fetch() println("Unique names: ") uniqueUserNames.forEach { println(it) }