1import javax.persistence.Entity;
2
3@Entity
4public class Wish {
5 Long productId;
6 Long quantity;
7 Client client;
8}
9
10@Entity
11public class Client {
12 String clientId;
13 String name;
14 String password;
15}
16
17import org.springframework.stereotype.Controller;
18import org.springframework.web.bind.annotation.RequestMapping;
19
20@Controller
21public class WishListController {
22
23 @PostMapping(path = "/saveForLater")
24 public String saveForLater(Wish wish) {
25 session.save(wish);
26 }
27
28 @RequestMapping(path = "/saveForLater", method = RequestMethod.POST)
29 public String saveForLater(Wish wish) {
30 session.save(wish);
31 }
32}
33
1public class WishDTO {
2 Long productId;
3 Long quantity;
4 Long clientId;
5}
6
7import org.springframework.stereotype.Controller;
8import org.springframework.web.bind.annotation.RequestMapping;
9
10@Controller
11public class PurchaseOrderController {
12
13 @PostMapping(path = "/saveForLater")
14 public String saveForLater(WishDTO wish) {
15 Wish persistentWish = new Wish();
16 // do the mapping between "wish" and "persistentWish"
17 [...]
18 session.save(persistentWish);
19 }
20
21 @RequestMapping(path = "/saveForLater", method = RequestMethod.POST)
22 public String saveForLater(WishDTO wish) {
23 Wish persistentWish = new Wish();
24 // do the mapping between "wish" and "persistentWish"
25 [...]
26 session.save(persistentWish);
27 }
28}
29