|
|
|
@ -15,6 +15,8 @@ import org.springframework.web.bind.annotation.PutMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
|
|
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
|
|
|
|
|
|
|
|
|
@RestController
|
|
|
|
|
@RequestMapping("/api/provincia")
|
|
|
|
@ -65,7 +67,9 @@ public class ProvinciaController {
|
|
|
|
|
try {
|
|
|
|
|
Field campoEntidad = Provincia.class.getDeclaredField(fieldName);
|
|
|
|
|
campoEntidad.setAccessible(true);
|
|
|
|
|
campoEntidad.set(entity, fieldValue);
|
|
|
|
|
ObjectMapper mapper = new ObjectMapper();
|
|
|
|
|
mapper.registerModule(new JavaTimeModule());
|
|
|
|
|
campoEntidad.set(entity, mapper.convertValue(fieldValue, campoEntidad.getType()));
|
|
|
|
|
} catch (NoSuchFieldException | IllegalAccessException ex) {
|
|
|
|
|
// maneja la excepción si ocurre algún error al acceder al campo
|
|
|
|
|
}
|
|
|
|
|