@RequestMapping( value = {"/CuentaBancaria/{idCuentaBancaria}"}, method = RequestMethod.PUT, produces = "application/json") public void update( HttpServletRequest httpRequest, HttpServletResponse httpServletResponse, @PathVariable("idCuentaBancaria") int idCuentaBancaria, @RequestBody String json) { try { ObjectMapper objectMapper = new ObjectMapper(); CuentaBancaria cuentaBancaria = cuentaBancariaDAO.read(idCuentaBancaria); httpServletResponse.setStatus(HttpServletResponse.SC_OK); CuentaBancaria cuentaBancaria2 = (CuentaBancaria) objectMapper.readValue(json, CuentaBancaria.class); cuentaBancaria.setCif(cuentaBancaria2.getCif()); cuentaBancaria.setDc(cuentaBancaria2.getDc()); cuentaBancaria.setNumeroDeCuenta(cuentaBancaria2.getNumeroDeCuenta()); cuentaBancaria.setSaldo(cuentaBancaria2.getSaldo()); cuentaBancaria.setSucursalBancaria(cuentaBancaria2.getSucursalBancaria()); cuentaBancariaDAO.update(cuentaBancaria); httpServletResponse.setContentType("application/json; charset=UTF-8"); json = objectMapper.writeValueAsString(cuentaBancaria); httpServletResponse.getWriter().println(json); } catch (Exception ex) { Logger.getLogger(EntidadBancariaController.class.getName()).log(Level.SEVERE, null, ex); } }