inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

실전! Querydsl

Querydsl 설정과 검증

QueryDsl 2.x 설정시 에러 발생합니다.

882

빛혜원

작성한 질문수 15

0

1차 시도로 강의자료를 보고 그대로 따라한 후 우측 Gradle Tasks/orther/compileQueryDsl 누르니

plugins {
    id 'java'
    id 'org.springframework.boot' version '2.7.12'
    //querydsl 추가
    id "com.ewerk.gradle.plugins.querydsl" version "1.0.10"
    id 'io.spring.dependency-management' version '1.0.15.RELEASE'
}

group = 'study'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'

configurations {
    compileOnly {
        extendsFrom annotationProcessor
    }
}

repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    compileOnly 'org.projectlombok:lombok'
    runtimeOnly 'com.h2database:h2'
    annotationProcessor 'org.projectlombok:lombok'

//querydsl 추가
    implementation 'com.querydsl:querydsl-jpa'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

tasks.named('test') {
    useJUnitPlatform()
}

//querydsl 추가 시작
def querydslDir = "$buildDir/generated/querydsl"
querydsl {
    jpa = true
    querydslSourcesDir = querydslDir
}
sourceSets {
    main.java.srcDir querydslDir
}
configurations {
    querydsl.extendsFrom compileClasspath
}
compileQuerydsl {
    options.annotationProcessorPath = configurations.querydsl
}
//querydsl 추가 끝

아래와 같은 에러가 발생했습니다.

Unable to load class 'com.mysema.codegen.model.Type'.

This is an unexpected error. Please file a bug containing the idea.log file.

 

그래서 커뮤니티에 올라온 질문에 대한 답을 보고 따라해봤습니다.

plugins {
    id 'java'
    id 'org.springframework.boot' version '2.7.12'
    id 'io.spring.dependency-management' version '1.0.15.RELEASE'
}

group = 'study'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'

configurations {
    compileOnly {
        extendsFrom annotationProcessor
    }
}

repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    compileOnly 'org.projectlombok:lombok'
    runtimeOnly 'com.h2database:h2'
    annotationProcessor 'org.projectlombok:lombok'
    //Querydsl 추가
    implementation 'com.querydsl:querydsl-jpa'
    annotationProcessor "com.querydsl:querydsl-apt:${dependencyManagement.importedProperties['querydsl.version']}:jpa"
    annotationProcessor "jakarta.annotation:jakarta.annotation-api"
    annotationProcessor "jakarta.persistence:jakarta.persistence-api"



    testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

tasks.named('test') {
    useJUnitPlatform()
}

//Querydsl 추가, 자동 생성된 Q클래스 gradle clean으로 제거
clean {
    delete file('src/main/generated')
}

노란박스 안에 compileQueryDsl 버튼이 생기지 않습니다. 어떻게 해결해야될까요???

java jpa

답변 1

0

Dompoo

그냥 빌드해도 안생기나요?

1

빛혜원

build 하니까 해결 됐습니당 . 감사합니당

SpringBoot 4.X에서의 Querydsl 설정

0

90

2

querydsl 오픈소스에 대한 질문

0

72

1

예제에서의 카운트 쿼리에서 join문과 where문은 필요없지 않나요?

0

109

1

Querydsl 6.X버전에 대해서 어떻게 생각하시나요?

0

317

2

여러 테이블 조인하여 통계치를 구하고자 할 때 어떤 방법이 더 효율적일까요

1

70

1

fetchResults()는 더이상 권장되지 않는다는데 맞나요?

0

160

1

querydsl sum() 메서드 없어요.

0

159

2

build 디렉터리 생성

0

138

2

자바 ORM 표준 JPA 프로그래밍 - 기본편 듣고 바로 학습해도 괜찮을까요?

0

114

2

현재 Querydsl에서 from절 서브쿼리를 지원하나요?

0

92

1

오타 제보 드립니다.

0

72

2

벌크 연산과 flush, clear

0

76

1

Run As Intellij 로 변경시 Q타입 import 불가

0

88

1

QHello import하기 문제 발생

0

147

2

등록된 함수 보는법(H2Dialect) 질문

0

68

2

5.0부터 Querydsl은 향후 fetchCount() , fetchResult() 를 지원하지 않기로 결정했다고 하는데 이에 맞는 강의

1

197

2

[환경설정 PDF 부트 3.0이후 설명 질문] build.gradle에 compileQuerydsl을 정의하지 않은 상태에서 Gradle->Tasks->other->compileQuerydsl을 클릭하라고 하는 이유가 무엇인가요??

1

201

1

querydsl 설정 문제

0

222

2

quey dsl 설정부분

0

158

2

count 쿼리 관련 질문입니다!

0

75

1

stringtemplate를 이용하여 where절 검색 방법 질문 드립니다.

0

89

1

답변부탁드리겠습니다.

0

90

2

(OrderSpecifier)관련 내용 어디있을가요

0

66

1

중급문법 벌크연산에서

0

82

2