[Use Case]: Fetching
- Dominant language
- Java
- Stars
- 150
- Forks
- 37
- Avg merge
- 4d 4h
- Merged PRs (30d)
- 34
Description
### As a ...
- [ ] Application user/user of the configuration itself
- [x] API user (application developer)
- [ ] SPI user (container or runtime developer)
- [ ] Specification implementer
### I need to be able to ...
... specify that certain fields of an entity should be fetched by a repository method.
### Which enables me to ...
... control the number of queries executed against the datastore and the amount of data which is fetched.
### Additional information
By analogy with `@OrderBy`, I propose a `@Fetch` or `@Fetching` annotation:
```java
@Find
@Fetching(_Book.AUTHORS)
@Fetching(_Book.PUBLISHER)
Book bookWithAuthors(String isbn);
```
For implementations based on Jakarta Persistence, this might be backed by construction of an `EntityGraph`.
Contributor guide
Research direction
No implementation file or test is named. Start by reviewing the existing @OrderBy and repository-method API, then evaluate the proposed @Fetch/@Fetching annotations and the Jakarta Persistence EntityGraph approach. Done means an agreed way to request selected entity fields while controlling datastore queries and fetched data, with the corresponding API behavior specified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, backend-api-design
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100