I have a spring RepositoryRestController with following method:
@RequestMapping(method = RequestMethod.POST, value = "/doSomethingWithEntity")
public @ResponseBody ResponseEntity deleteEmployeeSalaryPosition(@RequestBody Resource<Entity> entity)
I want to post an existing entity to this endpoint.
For example Entity class looks like this:
public Entity {
Long id;
String firstField;
String secondField;
EntityB relatedEntity;
}
Posting following JSON to endpoint
{
id: 1,
firstField: "someThing",
secondField: "BUMP",
relatedEntity: "<root>/api/entityB/1:
}
will result in endpoint deserializing to instace of Entity with following values in its fields
Entity:
id = null
firstfield = "someThing"
secondField = "BUMP",
relatedEntity = instance of EntityB.class with everything related
What I would expect is:
Entity:
id = 1
firstfield = "someThing"
secondField = "BUMP",
relatedEntity = instance of EntityB.class with everything related
The question is how to populate id with a value?
I tried all the combinations of _links[self, entity...].