source: src/main/java/com/example/rezevirajmasa/demo/model/Menu.java@ b67dfd3

main
Last change on this file since b67dfd3 was b67dfd3, checked in by Aleksandar Panovski <apano77@…>, 12 days ago

Normalization needed to continue, till here done

  • Property mode set to 100644
File size: 1.4 KB
Line 
1package com.example.rezevirajmasa.demo.model;
2
3import com.fasterxml.jackson.annotation.JsonIgnore;
4import jakarta.persistence.*;
5import lombok.Data;
6
7import java.math.BigDecimal;
8import java.util.ArrayList;
9import java.util.List;
10
11@Entity
12@Table(name = "menus")
13@Data
14public class Menu {
15 @Id
16 @GeneratedValue(strategy = GenerationType.IDENTITY)
17 @Column(name = "menu_id")
18 private Long menuID;
19
20 @ManyToOne
21 @JoinColumn(name = "restaurant_id", nullable = false)
22 @JsonIgnore
23 private Restaurant restaurant;
24
25 @Column(name = "item_name", length = 100)
26 private String itemName;
27
28 @Column(name = "menuCategory", length = 50)
29 private String menuCategory;
30
31 @Column(name = "price", precision = 8, scale = 2)
32 private BigDecimal price;
33
34 @Column(name = "description")
35 private String description;
36
37 @OneToMany(mappedBy = "menu", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY)
38 private List<MenuTag> tags = new ArrayList<>();
39
40 public Menu() {
41 }
42
43 public Menu(Long menuID, Restaurant restaurant, String itemName, String category, BigDecimal price, String description, List<MenuTag> tags) {
44 this.menuID = menuID;
45 this.restaurant = restaurant;
46 this.itemName = itemName;
47 this.menuCategory = category;
48 this.price = price;
49 this.description = description;
50 this.tags = tags;
51 }
52}
Note: See TracBrowser for help on using the repository browser.