source: src/main/java/com/example/villadihovo/model/reservations/ReservationForPreparedMeal.java

Last change on this file was f7c05a1, checked in by Elena Shulevska <elena.shulevska@…>, 15 months ago

initial commit of the source code on origin

  • Property mode set to 100644
File size: 1.3 KB
Line 
1package com.example.villadihovo.model.reservations;
2
3import com.example.villadihovo.model.offers.Meal;
4import com.example.villadihovo.model.offers.PreparedMeal;
5import jakarta.persistence.*;
6import jakarta.validation.constraints.Min;
7import lombok.AllArgsConstructor;
8import lombok.Data;
9import lombok.NoArgsConstructor;
10import org.hibernate.annotations.OnDelete;
11import org.hibernate.annotations.OnDeleteAction;
12
13@Data
14@AllArgsConstructor
15@NoArgsConstructor
16@Entity
17@Table(name = "reservation_for_prepared_meal")
18public class ReservationForPreparedMeal {
19
20 @EmbeddedId
21 private ReservationForPreparedMealId id;
22
23 @Column(name = "quantity")
24 @Min(value = 0, message = "Quantity must be greater than or equal to 0")
25 private Integer quantity;
26
27 @ManyToOne(cascade = CascadeType.ALL)
28 @JoinColumn(name = "reservation_id", referencedColumnName = "reservation_id", insertable = false, updatable = false)
29 private Reservation reservation_id;
30
31 @ManyToOne
32 @JoinColumns({
33 @JoinColumn(name = "prepared_meal_id", referencedColumnName = "prepared_meal_id", insertable = false, updatable = false)
34 })
35 private PreparedMeal prepared_meal_id;
36
37 @ManyToOne
38 @JoinColumn(name = "meal_id", referencedColumnName = "meal_id", insertable = false, updatable = false)
39 private Meal meal_id;
40
41}
Note: See TracBrowser for help on using the repository browser.