[e6c2521] | 1 | package com.tourMate.entities;
|
---|
| 2 |
|
---|
| 3 | import jakarta.persistence.*;
|
---|
| 4 |
|
---|
| 5 | import javax.validation.constraints.NotNull;
|
---|
| 6 | import java.util.Date;
|
---|
| 7 |
|
---|
| 8 | @Entity
|
---|
| 9 | @Table(name= "HotelRoomsAvailable", schema = "public")
|
---|
| 10 | public class HotelRoomAvailable {
|
---|
| 11 | private long hotelRoomAvailableId;
|
---|
| 12 | private HotelRoom hotelRoom;
|
---|
| 13 | @Temporal(TemporalType.DATE)
|
---|
| 14 | private Date dateFrom;
|
---|
| 15 | @Temporal(TemporalType.DATE)
|
---|
| 16 | private Date dateTo;
|
---|
| 17 | private Integer numberOfBeds;
|
---|
| 18 |
|
---|
| 19 | public HotelRoomAvailable(HotelRoom hotelRoom, Date dateFrom, Date dateTo, Integer numberOfBeds) {
|
---|
| 20 | this.hotelRoom = hotelRoom;
|
---|
| 21 | this.dateFrom = dateFrom;
|
---|
| 22 | this.dateTo = dateTo;
|
---|
| 23 | this.numberOfBeds = numberOfBeds;
|
---|
| 24 | }
|
---|
| 25 |
|
---|
| 26 | public HotelRoomAvailable(Date dateFrom, Date dateTo, Integer numberOfBeds) {
|
---|
| 27 | this.dateFrom = dateFrom;
|
---|
| 28 | this.dateTo = dateTo;
|
---|
| 29 | this.numberOfBeds = numberOfBeds;
|
---|
| 30 | }
|
---|
| 31 |
|
---|
| 32 |
|
---|
| 33 | public HotelRoomAvailable() {
|
---|
| 34 | }
|
---|
| 35 |
|
---|
| 36 | @Id
|
---|
| 37 | @GeneratedValue(strategy = GenerationType.IDENTITY)
|
---|
| 38 | @Column(name="hotel_room_available_id", unique = true,nullable = false)
|
---|
| 39 | public long getHotelRoomAvailableId() {
|
---|
| 40 | return hotelRoomAvailableId;
|
---|
| 41 | }
|
---|
| 42 |
|
---|
| 43 | public void setHotelRoomAvailableId(long hotelRoomAvailableId) {
|
---|
| 44 | this.hotelRoomAvailableId = hotelRoomAvailableId;
|
---|
| 45 | }
|
---|
| 46 |
|
---|
| 47 | @ManyToOne(fetch = FetchType.EAGER)
|
---|
| 48 | @JoinColumn(name = "room_id", unique = false, nullable = false, foreignKey = @ForeignKey(name = "fk_ref_od_roomavailable_kon_room"))
|
---|
| 49 | public HotelRoom getHotelRoom() {
|
---|
| 50 | return hotelRoom;
|
---|
| 51 | }
|
---|
| 52 |
|
---|
| 53 | public void setHotelRoom(HotelRoom hotelRoomId) {
|
---|
| 54 | this.hotelRoom = hotelRoomId;
|
---|
| 55 | }
|
---|
| 56 |
|
---|
| 57 | @Column(name="date_from", unique = false, nullable = false)
|
---|
| 58 | @NotNull
|
---|
| 59 | public Date getDateFrom() {
|
---|
| 60 | return dateFrom;
|
---|
| 61 | }
|
---|
| 62 |
|
---|
| 63 | public void setDateFrom(Date dateFrom) {
|
---|
| 64 | this.dateFrom = dateFrom;
|
---|
| 65 | }
|
---|
| 66 | @Column(name="date_to", unique = false, nullable = false)
|
---|
| 67 | @NotNull
|
---|
| 68 | public Date getDateTo() {
|
---|
| 69 | return dateTo;
|
---|
| 70 | }
|
---|
| 71 |
|
---|
| 72 | public void setDateTo(Date dateTo) {
|
---|
| 73 | this.dateTo = dateTo;
|
---|
| 74 | }
|
---|
| 75 |
|
---|
| 76 | @Column(name="number_of_beds", unique = false, nullable = false)
|
---|
| 77 | @NotNull
|
---|
| 78 | public Integer getNumberOfBeds() {
|
---|
| 79 | return numberOfBeds;
|
---|
| 80 | }
|
---|
| 81 |
|
---|
| 82 | public void setNumberOfBeds(Integer numberOfBeds) {
|
---|
| 83 | this.numberOfBeds = numberOfBeds;
|
---|
| 84 | }
|
---|
| 85 | }
|
---|