spring-projects / spring-projects/spring-data-rest

Accessing ManyToOne relations with Spring's RestTemplate (HTTP 400) [DATAREST-476]

Open
#855 0 comments 0 reactions 1 assignee View on GitHub

@odrotbohm is already working on this.

Since Dec 31, 2020.

in: repository type: bug
Dominant language
Java
Stars
958
Forks
568
PR merge metrics
No merged PRs in 30d

Description

Moritz Schulze opened DATAREST-476 and commented

Accessing exported @ManyToOne relationships strangely fails with Spring's RestTemplate with the status code 400 and the message

AbstractRepositoryRestController : Map has no value for 'repository'

So if I have a class Person and a class Address which references Person with @ManyToOne I can't access /addresses/0/person with the RestTemplate.

It works fine with command line curl or Apache's HttpClient. I tried debugging it a bit but have no clue why this is not working. I'm not even sure if SDR is the right project for this bug.

Attached is an example project with three tests that show the behaviour


Affects: 2.2.1 (Evans SR1)

Attachments:

1 votes, 2 watchers

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.