I made a Restful API with Spring Boot. One of my methods is a delete that takes the Response object and does some other queries eventually deleting the object from the DB depending on conditions. However, it is failing before the function body due to a type mismatch trying to convert String to Long.
I am using JSON in the request which does not use the Long type, so I use a string like this "id":"1"
instead, which won't convert for some reason. Does anyone have a suggestion?
Response Object:
public class Response {
private long id;
private String key;
private String value;
private String group;
public Response(String key, String value, String group) {
this.key = key;
this.value = value;
this.group = group;
}
I use a GeneratedValue(strategy = GenerationType.IDENTITY)
to auto-create IDs.
It seems to fail when attempting to convert the JSON to a Response object:
public ResponseEntity<String> deleteResponse(@RequestBody Response response) {
}