Querydsl 일대다 관계에서 빈객체 반환에 대한 질문이있습니다.
272
작성자 없음
작성한 질문수 0
List<ContentsDtoRes> contents = queryFactory
.selectFrom(ParentEntity)
.leftJoin(ParentEntity.childList, childEntity)
.leftJoin(childEntity.childChildEntity, childchildEntity)
.where(
systemDelYnEq(condition.getDelYn()),
autoDelYnEq(condition.getDelYn())
)
.offset(pageable.getOffset())
.limit(pageable.getPageSize())
.transform(
groupBy(systemEntity.sysId).list(
new QContentsDtoRes(
parentEntity.a,
parentEntity.b,
parentEntity.c,
parentEntity.d,
parentEntity.e,
list(
new QChildDto(
childEntity.a,
childEntity.b
)
),
list(
new QchildChildDto(
childChild.a,
childChild.b,
childChild.c,
childChild.d
)
)
)
)
);안녕하세요 강사님. ㅎ
Querydsl 의 일대다 관계에 대해서 질문이있어 올리게되었습니다.
예를들어 위와 같이 부모엔티티와 자식엔티티의 일대 다 관계가 될 경우
ParentEntity 는 존재하고 childEntity 가 없을 경우 querydsl 에서는 NPE 가 아닌
빈객체를 반환하게 되는데 아래와 같이 @QueryProject 생성자
하위에서 이렇게 빈객체를 체크하고 비워주는 작업을 할 수 밖에 없는건가요.?
this.childList.addAll(childList.stream()
.filter(child -> child.getId() != null).collect(Collectors.toList()));
this.childChildList.addAll(childChildList.stream()
.filter(childchild -> childchild.getId() != null).collect(Collectors.toList()));
}혹시 다른 방법이 있다면 어떤 방법이 있을지 궁금합니다.
항상 좋은강의 감사합니다.! 좋은하루되세요
답변 1
SpringBoot 4.X에서의 Querydsl 설정
0
127
2
querydsl 오픈소스에 대한 질문
1
91
1
예제에서의 카운트 쿼리에서 join문과 where문은 필요없지 않나요?
0
121
1
Querydsl 6.X버전에 대해서 어떻게 생각하시나요?
0
339
2
여러 테이블 조인하여 통계치를 구하고자 할 때 어떤 방법이 더 효율적일까요
1
80
1
fetchResults()는 더이상 권장되지 않는다는데 맞나요?
0
169
1
querydsl sum() 메서드 없어요.
0
166
2
build 디렉터리 생성
0
148
2
자바 ORM 표준 JPA 프로그래밍 - 기본편 듣고 바로 학습해도 괜찮을까요?
0
121
2
현재 Querydsl에서 from절 서브쿼리를 지원하나요?
0
98
1
오타 제보 드립니다.
0
78
2
벌크 연산과 flush, clear
0
83
1
Run As Intellij 로 변경시 Q타입 import 불가
0
94
1
QHello import하기 문제 발생
0
152
2
등록된 함수 보는법(H2Dialect) 질문
0
74
2
5.0부터 Querydsl은 향후 fetchCount() , fetchResult() 를 지원하지 않기로 결정했다고 하는데 이에 맞는 강의
1
203
2
[환경설정 PDF 부트 3.0이후 설명 질문] build.gradle에 compileQuerydsl을 정의하지 않은 상태에서 Gradle->Tasks->other->compileQuerydsl을 클릭하라고 하는 이유가 무엇인가요??
1
208
1
querydsl 설정 문제
0
225
2
quey dsl 설정부분
0
162
2
count 쿼리 관련 질문입니다!
0
77
1
stringtemplate를 이용하여 where절 검색 방법 질문 드립니다.
0
94
1
답변부탁드리겠습니다.
0
93
2
(OrderSpecifier)관련 내용 어디있을가요
0
67
1
중급문법 벌크연산에서
0
85
2





