source: src/main/java/com/tourMate/entities/Hotels.java@ e9b4ba9

Last change on this file since e9b4ba9 was e9b4ba9, checked in by darsov2 <62809499+darsov2@…>, 6 months ago

prototype

  • Property mode set to 100644
File size: 3.7 KB
Line 
1package com.tourMate.entities;
2
3import jakarta.persistence.*;
4import javax.validation.constraints.NotNull;
5import java.util.ArrayList;
6import java.util.Collection;
7
8@Entity
9@Table(name = "hotels",schema = "public")
10public class Hotels {
11 private long hotelId;
12 private String hotelName;
13 private String hotelDescripiton;
14 private String hotelLocation;
15 private String hotelEDBS;
16 private Boolean parking;
17 private Boolean petFriendly;
18 private Boolean internetAvailable;
19 private User owner;
20 private Collection<HotelRoom> hotelRooms = new ArrayList<>();
21
22 public Hotels(String hotelName, String hotelDescripiton, String hotelLocation, String hotelEDBS, Boolean parking, Boolean petFriendly, Boolean internetAvailable, User ownerId) {
23 this.hotelName = hotelName;
24 this.hotelDescripiton = hotelDescripiton;
25 this.hotelLocation = hotelLocation;
26 this.hotelEDBS = hotelEDBS;
27 this.parking = parking;
28 this.petFriendly = petFriendly;
29 this.internetAvailable = internetAvailable;
30 this.owner = ownerId;
31 }
32
33 public Hotels() {
34 }
35
36 @Id
37 @GeneratedValue(strategy = GenerationType.IDENTITY)
38 @Column(name = "hotel_id", unique = true, nullable = false)
39 public long getHotelId(){return hotelId;}
40
41 public void setHotelId(long hotelId){this.hotelId=hotelId;}
42
43 @Column(name="hotel_name",unique = false,nullable = false)
44 @NotNull
45 public String getHotelName() {
46 return hotelName;
47 }
48
49 public void setHotelName(String hotelName) {
50 this.hotelName = hotelName;
51 }
52
53 @Column(name="hotel_description",unique = false,nullable = false)
54 @NotNull
55 public String getHotelDescripiton() {
56 return hotelDescripiton;
57 }
58
59 public void setHotelDescripiton(String hotelDescripiton) {
60 this.hotelDescripiton = hotelDescripiton;
61 }
62
63 @Column(name="hotel_location",unique = false,nullable = false)
64 @NotNull
65 public String getHotelLocation() {
66 return hotelLocation;
67 }
68
69 public void setHotelLocation(String hotelLocation) {
70 this.hotelLocation = hotelLocation;
71 }
72
73 @Column(name="hotel_edbs",unique = true,nullable = false)
74 @NotNull
75 public String getHotelEDBS() {
76 return hotelEDBS;
77 }
78
79 public void setHotelEDBS(String hotelEDBS) {
80 this.hotelEDBS = hotelEDBS;
81 }
82
83 @Column(name="hotel_parking",unique = false,nullable = false)
84 @NotNull
85 public Boolean getParking() {
86 return parking;
87 }
88
89 public void setParking(Boolean parking) {
90 this.parking = parking;
91 }
92
93 @Column(name="hotel_petfriendly",unique = false,nullable = false)
94 @NotNull
95 public Boolean getPetFriendly() {
96 return petFriendly;
97 }
98
99 public void setPetFriendly(Boolean petFriendly) {
100 this.petFriendly = petFriendly;
101 }
102 @Column(name="hotel_internet",unique = false, nullable = false)
103 @NotNull
104 public Boolean getInternetAvailable() {
105 return internetAvailable;
106 }
107
108 public void setInternetAvailable(Boolean internetAvailable) {
109 this.internetAvailable = internetAvailable;
110 }
111
112 @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "hotel")
113 public Collection<HotelRoom> getHotelRooms() {
114 return hotelRooms;
115 }
116
117 public void setHotelRooms(Collection<HotelRoom> hotelRooms) {
118 this.hotelRooms = hotelRooms;
119 }
120
121 @ManyToOne(fetch = FetchType.EAGER)
122 @JoinColumn(name = "owner_id", unique = false, nullable = false, foreignKey = @ForeignKey(name = "fk_ref_od_hotel_kon_user"))
123 public User getOwner() {
124 return owner;
125 }
126
127 public void setOwner(User ownerId) {
128 this.owner = ownerId;
129 }
130}
Note: See TracBrowser for help on using the repository browser.