-
[QueryDsl] QEntity 연관관계 초기화 2Depth 이상 적용시키기개발/Spring Boot 2021. 10. 1. 18:19
https://querydsl.com/static/querydsl/4.2.1/reference/html/ch03s03.html#d0e2181
By default Querydsl initializes only reference properties of the first two levels. In cases where longer initialization paths are required, these have to be annotated in the domain types via com.querydsl.core.annotations.QueryInit annotations. QueryInit is used on properties where deep initializations are needed. The following example demonstrates the usage.
@Entity class Event { @QueryInit("customer.address") Account account; } @Entity class Account { Customer customer; } @Entity class Customer { String name; Address address; // ... }
This example enforces the initialization of the account.customer path, when an Event path is initialized as a root path / variable. The path initialization format supports wildcards as well, e.g. "customer.*" or just "*".
QueryDsl 사용중, 관계가 깊은 QEntity의 query를 만들 때 자꾸 null인 멤버QEntity가 존재하길래 해결방안 찾아서 메모메모
'개발 > Spring Boot' 카테고리의 다른 글
Mybatis Interceptor 자동 Paging처리 사용방법 (2) 2021.04.24 Mybatis Interceptor 자동 Paging처리 만들기(2) (0) 2021.04.20 Mybatis Interceptor 자동 Paging처리 만들기(1) (0) 2021.04.19 @ConfigurationProperties, @EnableConfigurationProperties (0) 2020.05.15