Querydsl 일대다 관계에서 빈객체 반환에 대한 질문이있습니다.
275
작성자 없음
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
join에대해 질문드립니다.
0
26
1
SpringBoot 4.X에서의 Querydsl 설정
0
222
2
querydsl 오픈소스에 대한 질문
1
112
1
예제에서의 카운트 쿼리에서 join문과 where문은 필요없지 않나요?
0
137
1
Querydsl 6.X버전에 대해서 어떻게 생각하시나요?
0
373
2
여러 테이블 조인하여 통계치를 구하고자 할 때 어떤 방법이 더 효율적일까요
1
99
1
fetchResults()는 더이상 권장되지 않는다는데 맞나요?
0
186
1
querydsl sum() 메서드 없어요.
0
183
2
build 디렉터리 생성
0
158
2
자바 ORM 표준 JPA 프로그래밍 - 기본편 듣고 바로 학습해도 괜찮을까요?
0
139
2
현재 Querydsl에서 from절 서브쿼리를 지원하나요?
0
114
1
오타 제보 드립니다.
0
90
2
벌크 연산과 flush, clear
0
93
1
Run As Intellij 로 변경시 Q타입 import 불가
0
103
1
QHello import하기 문제 발생
0
172
2
등록된 함수 보는법(H2Dialect) 질문
0
96
2
5.0부터 Querydsl은 향후 fetchCount() , fetchResult() 를 지원하지 않기로 결정했다고 하는데 이에 맞는 강의
1
219
2
[환경설정 PDF 부트 3.0이후 설명 질문] build.gradle에 compileQuerydsl을 정의하지 않은 상태에서 Gradle->Tasks->other->compileQuerydsl을 클릭하라고 하는 이유가 무엇인가요??
1
224
1
querydsl 설정 문제
0
237
2
quey dsl 설정부분
0
180
2
count 쿼리 관련 질문입니다!
0
82
1
stringtemplate를 이용하여 where절 검색 방법 질문 드립니다.
0
105
1
답변부탁드리겠습니다.
0
97
2
(OrderSpecifier)관련 내용 어디있을가요
0
68
1





