spring-projects / spring-projects/spring-data-rest
Include 'embedded' objects via request URL [DATAREST-211]
@odrotbohm is already working on this.
Since Dec 31, 2020.
- Dominant language
- Java
- Stars
- 958
- Forks
- 568
- PR merge metrics
- No merged PRs in 30d
Description
Benjamin M opened DATAREST-211 and commented
We all know the problem:
@Entity
class A {
@ManyToOne B b;
}
@Entity
class B {
@OneToMany List<A> as;
@OneToOne C c;
}
The URLs for A and B only expose Links to the embedded entities, which is clear. But because of the n+1 query problem it should be possible to eager fetch those entities somehow and deliver them to the client using ONE request.
The simplest solution I can imagine is to let the client decide which resources to fetch. Look at this URL:
or maybe even:
http://.../as/ID?include=b,b.c
This would be an AWESOME feature!
Affects: 2.0 M1 (Codd)
1 votes, 4 watchers
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.