Update Javadoc for BatchMapping
Closes gh-166
This commit is contained in:
@@ -290,11 +290,11 @@ default it is marked as `INTERNAL_ERROR`.
|
||||
|
||||
Given a `Book` and its `Author`, we can create one `DataFetcher` for books and another
|
||||
for the author of a book. This means books and authors aren't automatically loaded
|
||||
together, which enables queries to select the subset of data they need. However, when
|
||||
loading multiple books, the author for each book is loaded individually, and this is
|
||||
an issue known as the N+1 select problem.
|
||||
together, which enables queries to select the subset of data they need. However, loading
|
||||
multiple books, results in loading each author individually, and this is a performance
|
||||
issue known as the N+1 select problem.
|
||||
|
||||
To address the issue, GraphQL Java provides a
|
||||
GraphQL Java provides a
|
||||
https://www.graphql-java.com/documentation/v16/batching/[batching feature] that allows
|
||||
related entities, such as the authors for all books, to be loaded together. This is how
|
||||
the underlying mechanism works in GraphQL Java:
|
||||
@@ -310,7 +310,7 @@ defers until it is ready to batch load all related entities as one.
|
||||
- `DataLoader` additionally maintains a cache of previously loaded entities that can
|
||||
further improve efficiency when the same entity is in multiple places of the response.
|
||||
|
||||
Spring GraphQL exposes a `BatchLoaderRegistry` that accepts and stores registrations of
|
||||
Spring GraphQL provides a `BatchLoaderRegistry` that accepts and stores registrations of
|
||||
batch loading functions. The `ExecutionGraphQlService` accepts the registry as input and
|
||||
uses it to make per request `DataLoader` registrations. A `DataFetcher` then looks up the
|
||||
`DataLoader` for an entity and uses it to load instances, or in an annotated controller,
|
||||
|
||||
Reference in New Issue
Block a user