강의

멘토링

로드맵

Inflearn Community Q&A

ryang11192020's profile image
ryang11192020

asked

Practical! Spring Data JPA

@NamedEntityGraph 에서 연관된 엔티티를 2개 가져오고 싶을 때는 어떻게 해야하나요?

Resolved

Written on

·

298

0

@NamedEntityGraph(name = "Member.all", attributeNodes = @NamedAttributeNode("team"))

강의 자료 코드에서 Member 를 조회할 때 연관된 엔티티인 team 도 조회하는데
만약 Member 기준 다대일 관계인 엔티티가 하나 더 있어서 그 엔티티도 가져오려고 할 때는
@NamedEntityGraph 에서 어떻게 코드를 짜야할까요?
springJPAjavaspring-boot

Answer 1

1

안녕하세요. 허량님, 공식 서포터즈 y2gcoder입니다.

@NamedEntityGraph(name = "Member.all", attributeNodes = {
  @NamedAttributeNode("team"),
  @NamedAttributeNode("other")
})

 

이런 식으로 사용해보시겠어요?
조금 더 참고할만한 링크도 첨부하겠습니다.

https://milenote.tistory.com/151

감사합니다.

ryang11192020's profile image
ryang11192020

asked

Ask a question