Spring Data JPA And NamedEntityGraphs

前端 未结 5 621
挽巷
挽巷 2020-11-28 04:44

currently I am wrestling with being able to fetch only the data I need. The findAll() method needs to fetch data dependant on where its getting called. I do not want to end

5条回答
  •  失恋的感觉
    2020-11-28 05:36

    We had the same issue and built a Spring Data JPA extension to solve it :

    https://github.com/Cosium/spring-data-jpa-entity-graph

    This extension allows to pass named or dynamically built EntityGraph as an argument of any repository method.

    With this extension, you would have this method immediatly available:

    List findAll(Sort sort, EntityGraph entityGraph);
    

    And be able to call it with an EntityGraph selected at runtime.

提交回复
热议问题