Using the below code I am unable to get the results of my query. Whether I use Map
Map
It appears that the problem was that Map<ContentType, Integer>
does not have a promise of a unique index, so JPA doesn't like mapping to it. By using List<Map<ContentType, Integer>>
instead, it works great!
Try this it works
keep your model in list
@RequestMapping(value="/deleteDriver/{id}" , method=RequestMethod.POST)
public ResponseEntity<Object> deleteDriver(@PathVariable("id") Integer id)
{
List<Driver> delete_driver=adminService.getDriverById(id);
Map<String,Object> response=new HashMap<>();
if(delete_driver==null)
{
response.put("status", "Failure");
return new ResponseEntity<Object>(response,HttpStatus.NO_CONTENT);
}
else
{
response.put("status", "Success");
adminService.delete(delete_driver);
return new ResponseEntity<Object>(response,HttpStatus.OK);
}
}
then in your repository
@Override
public void delete(List<Driver> delete_driver) {
driverRepository.delete(delete_driver);
}