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.1 KB
|
Line | |
---|
1 | package com.example.villadihovo.model.reservations;
|
---|
2 |
|
---|
3 | import com.example.villadihovo.model.offers.Beverage;
|
---|
4 | import com.example.villadihovo.model.offers.Service;
|
---|
5 | import jakarta.persistence.*;
|
---|
6 | import jakarta.validation.constraints.Min;
|
---|
7 | import lombok.AllArgsConstructor;
|
---|
8 | import lombok.Data;
|
---|
9 | import lombok.NoArgsConstructor;
|
---|
10 |
|
---|
11 | @Data
|
---|
12 | @AllArgsConstructor
|
---|
13 | @NoArgsConstructor
|
---|
14 | @Entity
|
---|
15 | @IdClass(ServiceForBeveragesId.class)
|
---|
16 | @Table(name="service_for_beverages")
|
---|
17 | public class ServiceForBeverages {
|
---|
18 |
|
---|
19 | @Id
|
---|
20 | @Column(name = "service_id")
|
---|
21 | private Integer service_id;
|
---|
22 |
|
---|
23 | @Id
|
---|
24 | @Column(name = "beverage_id")
|
---|
25 | private Integer beverage_id;
|
---|
26 |
|
---|
27 | @Column(name = "quantity")
|
---|
28 | @Min(value = 0, message = "Quantity must be greater than or equal to 0")
|
---|
29 | private Integer quantity;
|
---|
30 |
|
---|
31 | @ManyToOne
|
---|
32 | @JoinColumn(name = "service_id", referencedColumnName = "service_id", insertable = false, updatable = false)
|
---|
33 | private Service service;
|
---|
34 |
|
---|
35 | @ManyToOne
|
---|
36 | @JoinColumn(name = "beverage_id", referencedColumnName = "beverage_id", insertable = false, updatable = false)
|
---|
37 | private Beverage beverage;
|
---|
38 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.