(+) 별칭(alias)
queryDsl 로 join 을 할 때, alias 를 걸어줘도 되고 안걸어줘도 무관하다.
/**
* Create a left join with the given target.
* Use fetchJoin() to add the fetchJoin parameter to this join.
*
* @param <P>
* @param target target
* @return the current object
*/
<P> JPQLQuery<T> leftJoin(CollectionExpression<?,P> target);
/**
* Create a left join with the given target and alias.
*
* @param <P>
* @param target target
* @param alias alias
* @return the current object
*/
<P> JPQLQuery<T> leftJoin(CollectionExpression<?,P> target, Path<P> alias);첫번째 파라미터가 target 으로 이름이 지어져 있는데, 말 그대로 from 에 걸어준 테이블과 해당 target 을 join 한다는 것이다.
만약 target 으로 정한 테이블의 컬럼과 추가적인 join 설정을 해야 할 경우 아래와 같이 alias 를 지정해주고, 지정해준 alias 의 path 를 이용해서 join 을 걸어주면 된다. 아래는 예시 코드이다.
Last updated