spring-projects / spring-projects/spring-data-jpa
SimpleJpaRepository.findAllById doesn't join eager fetched columns [DATAJPA-1721]
@schauder is already working on this.
Since Dec 30, 2020.
- Dominant language
- Java
- Stars
- 3.3k
- Forks
- 1.6k
- PR merge metrics
- No merged PRs in 30d
Description
cda opened DATAJPA-1721 and commented
Using SimpleJpaRepository.findById(ID is) results in a query with left outer joins for each eager relationship.
Using SimpleJpaRepository.findAllById(Iterable ids) results in a query that fetches current entity columns and additional select queries for each eager relationship.
The performance of findAllById is affected by the additional select queries. Ideally it should generate the same query as findById but with id in () instead of id = .
SimpleJpaRepository.findAllById(Iterable ids) is generating a JPQL query to fetch entities and reading Vlad Mihalcea article it seems that using JPQL to fetch entities uses a different fetching strategy than entitymanager.find that results in additional selects
No further details from DATAJPA-1721
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.