spring-projects / spring-projects/spring-data-rest
Configuring entityLookup for MyEntity breaks /myEntities/id (can be fixed by registering a BackendIdConverter). [DATAREST-1487]
@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
jvanheesch opened DATAREST-1487 and commented
Please see reference url for quick reproducer.
1st commit: I defined entities Book and Author, book has an author, and all endpoints were working.
2nd commit: I configured EntityLookup for AuthorRepository, which breaks the /authors/2 endpoint, resulting in
{
"cause": null,
"message": "class java.lang.String cannot be cast to class java.lang.Long (java.lang.String and java.lang.Long are in module java.base of loader 'bootstrap')"
}
3rd commit: I registered a BackendIdConverter for the Author class, which converts the String to a Long and vice versa, fixing /authors/2.
I assume this is considered a bug. If it's not, the issue type may be changed to 'Improvement'
Reference URL: https://github.com/jvanheesch/spring-data-rest-entitylookup-backend-id-converter
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.