Skip to content

Commit dd552f4

Browse files
committed
Fix spring-projects#108 owner update
1 parent 3bcf845 commit dd552f4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/main/java/org/springframework/samples/petclinic/web/OwnerController.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,11 @@ public String initUpdateOwnerForm(@PathVariable("ownerId") int ownerId, Model mo
111111
}
112112

113113
@RequestMapping(value = "/owners/{ownerId}/edit", method = RequestMethod.POST)
114-
public String processUpdateOwnerForm(@Valid Owner owner, BindingResult result) {
114+
public String processUpdateOwnerForm(@Valid Owner owner, @PathVariable("ownerId") int ownerId, BindingResult result) {
115115
if (result.hasErrors()) {
116116
return "owners/createOrUpdateOwnerForm";
117117
} else {
118+
owner.setId(ownerId);
118119
this.clinicService.saveOwner(owner);
119120
return "redirect:/owners/{ownerId}";
120121
}

0 commit comments

Comments
 (0)