I have a REST API controller like following code. If I use @valid
annotation, every field of Client's entity are controlled for validation.
@ResponseBody
@RequestMapping(value = API.UPDATE_CLIENT, produces = ResponseType.JSON, method = RequestMethod.POST)
public HashMap update(
@PathVariable(value = "id")int id,
@RequestBody Client clientData
) {
clientLogic.update(id, clientData);
....
}
Client's entity consists of about 5 fields (id, name, address, email, phone). When I update this records, I don't send all of 5 fields in RequestBody. I just want to validate coming from RequestBody.