main
Last change
on this file since c049fd6 was c049fd6, checked in by SazdovaEkaterina <sazdovaekaterina@…>, 13 months ago |
specify project schema in the backend
|
-
Property mode
set to
100644
|
File size:
1.0 KB
|
Line | |
---|
1 | package finki.paw5.model.entities;
|
---|
2 |
|
---|
3 | import finki.paw5.model.enumerations.FoodType;
|
---|
4 | import jakarta.persistence.*;
|
---|
5 | import lombok.Data;
|
---|
6 | import lombok.RequiredArgsConstructor;
|
---|
7 |
|
---|
8 | import java.util.List;
|
---|
9 |
|
---|
10 | @Data
|
---|
11 | @Entity
|
---|
12 | @RequiredArgsConstructor
|
---|
13 | @Table(name = "food", schema = "project")
|
---|
14 | public class Food {
|
---|
15 |
|
---|
16 | @Id
|
---|
17 | @GeneratedValue(strategy = GenerationType.IDENTITY)
|
---|
18 | @Column(name = "id_food")
|
---|
19 | private Integer id;
|
---|
20 |
|
---|
21 | @Column(name = "manufacturer", nullable = false, length = 100)
|
---|
22 | private String manufacturer;
|
---|
23 |
|
---|
24 | @Column(name = "name_food", nullable = false, length = 20)
|
---|
25 | private String name;
|
---|
26 |
|
---|
27 | @Column(name = "type_food", nullable = false)
|
---|
28 | private FoodType type;
|
---|
29 |
|
---|
30 | @ManyToMany
|
---|
31 | @JoinTable(name = "pet_preferably_eats_food",
|
---|
32 | joinColumns = @JoinColumn(name = "id_food"),
|
---|
33 | inverseJoinColumns = @JoinColumn(name = "id_pet"))
|
---|
34 | List<Pet> pets;
|
---|
35 |
|
---|
36 | public Food(String manufacturer, String name, FoodType type) {
|
---|
37 | this.manufacturer = manufacturer;
|
---|
38 | this.name = name;
|
---|
39 | this.type = type;
|
---|
40 | }
|
---|
41 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.