How to force eager loading with CrudRepository in spring-data?

前端 未结 4 1961
抹茶落季
抹茶落季 2021-01-11 10:43

I have an entity containing a List that is thus lazy loaded by default:

interface MyEntityRepository extends CrudRepository

        
4条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-11 11:28

    findAllById() uses eager fetch, no customization is needed.

      interface MyEntityRepository extends CrudRepository {        
        Optional findAllById(long id);
    }
    

提交回复
热议问题