====== JPA Named Entity Graph ====== * EntityGraph를 통해서 N + 1 문제 해결이 가능하다. * ''join fetch''와 유사하지만 차이점이 있다. * [[java:jpa:springdatajpa|Spring Data JPA]]에서는 ''@EntityGraph''로 사용 가능하다. * [[java:hibernate:performance|Hibernate Performance Tuning]] * [[https://www.youtube.com/watch?v=Dr5Qn6NC-3Y|5 ways to initialize lazy associations and when to use them - YouTube]] ===== spring-data-jpa-entity-graph ===== * [[https://github.com/Cosium/spring-data-jpa-entity-graph|Cosium/spring-data-jpa-entity-graph: Spring Data JPA extension allowing full dynamic usage of EntityGraph on repositories]] * CrudRepository 를 확장하여, EntityGrapth를 파라미터로 넘길 수 있기 하는 방식. ===== 참고 ===== * [[https://www.thoughts-on-java.org/jpa-21-entity-graph-part-1-named-entity/|JPA 2.1 Entity Graph : Part 1- Named entity graphs - Thoughts on Java]] * [[https://www.thoughts-on-java.org/jpa-21-entity-graph-part-2-define/|JPA 2.1 Entity Graph : Part 2- Define lazy/eager loading at runtime - Thoughts on Java]] * [[https://jojoldu.tistory.com/165|JPA N+1 문제 및 해결방안]] * [[https://www.baeldung.com/jpa-entity-graph|JPA Entity Graph | Baeldung]] * [[https://www.radcortez.com/jpa-entity-graphs/|JPA Entity Graphs | Roberto Cortez Java Blog]] * [[https://softwarehut.com/blog/no-lazyinitializationexception-use-jpa-2-1-entity-graph/|No More LazyInitializationException – Use JPA 2.1 Entity Graph - SoftwareHut]]