Spring Boot debug log (b) a data update operation the JPA

This simple thought can update a record, I did not expect in addition to other values ​​passed all turned into empty fields. This makes a very desperate.

The error code display

 //更新数据操作
    @RequestMapping(value = "/qq/bsideup")
    public BsideBean updateOne(@RequestParam("id") Integer id,@RequestParam("belongs") String belongs,
                               @RequestParam("status") String status){
        //更新操作
        BsideBean bsideBean = new BsideBean();

        bsideBean.setId(id);
        bsideBean.setBelongs(belongs);
        bsideBean.setStatus(status);
        return bsideDao.saveAndFlush(bsideBean);
    }

 

 

To this code, for example, after an incoming database, only the id, belogs, status value is normal, the rest is null.

1. Solution one, according to id to check out the data, and then transfer all the data back, and then be assigned.

 

Guess you like

Origin www.cnblogs.com/masterchd/p/12168402.html