@RequestMapping(value={"/",""},method=RequestMethod.POST) @ResponseBody public RestWrapper update(@ModelAttribute("busdomain") @Valid BusDomain busDomain,BindingResult bindingResult,Principal principal){
  RestWrapper restWrapper=null;
  if (bindingResult.hasErrors()) {
    BindingResultError bindingResultError=new BindingResultError();
    return bindingResultError.errorMessage(bindingResult);
  }
  try {
    com.wipro.ats.bdre.md.dao.jpa.BusDomain jpaBusDomain=new com.wipro.ats.bdre.md.dao.jpa.BusDomain();
    jpaBusDomain.setBusDomainId(busDomain.getBusDomainId());
    jpaBusDomain.setBusDomainName(busDomain.getBusDomainName());
    jpaBusDomain.setBusDomainOwner(busDomain.getBusDomainOwner());
    jpaBusDomain.setDescription(busDomain.getDescription());
    busDomainDAO.update(jpaBusDomain);
    restWrapper=new RestWrapper(busDomain,RestWrapper.OK);
    LOGGER.info(RECORDWITHID + busDomain.getBusDomainId() + " updated in BusDomain by User:"+ principal.getName()+ busDomain);
  }
 catch (  MetadataException e) {
    LOGGER.error(e);
    restWrapper=new RestWrapper(e.getMessage(),RestWrapper.ERROR);
  }
  return restWrapper;
}

@ RequestMapping ( value = { "/" , "" } , method = RequestMethod . POST ) @ ResponseBody public RestWrapper update ( @ ModelAttribute ( "busdomain" ) @ Valid BusDomain busDomain , BindingResult bindingResult , Principal principal ) { RestWrapper restWrapper = null ; if ( bindingResult . hasErrors ( ) ) { BindingResultError bindingResultError = new BindingResultError ( ) ; return bindingResultError . errorMessage ( bindingResult ) ; } try { com . wipro . ats . bdre . md . dao . jpa . BusDomain jpaBusDomain = new com . wipro . ats . bdre . md . dao . jpa . BusDomain ( ) ; jpaBusDomain . setBusDomainId ( busDomain . getBusDomainId ( ) ) ; jpaBusDomain . setBusDomainName ( busDomain . getBusDomainName ( ) ) ; jpaBusDomain . setBusDomainOwner ( busDomain . getBusDomainOwner ( ) ) ; jpaBusDomain . setDescription ( busDomain . getDescription ( ) ) ; busDomainDAO . update ( jpaBusDomain ) ; restWrapper = new RestWrapper ( busDomain , RestWrapper . OK ) ; LOGGER . info ( RECORDWITHID + busDomain . getBusDomainId ( ) + " updated in BusDomain by User:" + principal . getName ( ) + busDomain ) ; } catch ( MetadataException e ) { LOGGER . error ( e ) ; restWrapper = new RestWrapper ( e . getMessage ( ) , RestWrapper . ERROR ) ; } return restWrapper ; }
this method calls proc updatebusdomain and updates the record passed . it also validates the values passed .
