Using Spring framework, trying to do update rest operation, by changing only one attribute in payload
@RequestMapping(value = "/uiv/activeDiscrepancies/{id}", method = RequestMethod.PUT)
public ResponseEntity update(@PathVariable("id") BigInteger id,
@RequestBody ActiveDiscrepancies activeDiscrepancy)
throws SureException{
//ActiveDiscrepancies adiscrepancies =
activeDiscrepancyRepo.save(activeDiscrepancy, id);
ActiveDiscrepancies adiscrepancies = activeDiscrepancyRepo.findByActiveDiscrepancyId(id);
activeDiscrepancy.setActiveDiscrepancyId( adiscrepancies.getActiveDiscrepancyId() );
activeDiscrepancyRepo.save(activeDiscrepancy);
}
But update query fired is
Hibernate:
update ACTIVE_DISCREPANCIES
set ACTIVE_DISCREPANCY_NAME=?, AUDITED_ENTITY=?, CREATION_TIME=?,
DELTA_TYPE=?, DISCREPANCY=?, EXPIRY_TIME=?, LAST_UPDATED_TIME=?,
MESSAGE_KEY=?, NETWORK=?, RECON_REASON=?, RECON_TYPE=?,
REMARKS=?, RESOURCE_LABEL=?, STATUS=?
where ACTIVE_DISCREPANCY_ID=?
So for other columns is replaced with null values, how to solve this problem?