Skip to content
This repository has been archived by the owner on Jan 22, 2024. It is now read-only.

kotlin-example QueryDsl Version Update #106

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions gradle/kotlin-querydsl/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -33,12 +25,13 @@ object Test {

transaction.commit()

val query = JPAQuery(entityManager)
val query = JPAQuery<User>(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) }
Expand Down