| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- package pl.sudra.domain;
- import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
- import jakarta.persistence.*;
- import jakarta.validation.constraints.NotNull;
- import java.sql.Date;
- @Entity
- @Table(name = "reservation")
- public class Reservation {
- @Id
- @GeneratedValue(strategy = GenerationType.AUTO)
- private Long id;
- @ManyToOne(fetch = FetchType.EAGER)
- @JoinColumn(name = "userId")
- @JsonIgnoreProperties("reservations")
- private User user;
- @NotNull
- private Long boatId;
- @NotNull
- private Date date;
- @NotNull
- private byte startHour;
- @NotNull
- private byte endHour;
- @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
- @JoinColumn(name = "billId")
- private Bill bill;
- @Override
- public String toString() {
- return "Reservation{" +
- "id=" + id +
- ", user=" + user.getId() +
- ", boatId=" + boatId +
- ", date=" + date +
- ", startHour=" + startHour +
- ", endHour=" + endHour +
- ", bill=" + bill.getId() +
- '}';
- }
- public Reservation() {
- }
- public Long getId() {
- return id;
- }
- public void setId(Long id) {
- this.id = id;
- }
- public User getUser() {
- return user;
- }
- public void setUser(User user) {
- this.user = user;
- }
- public Long getBoatId() {
- return boatId;
- }
- public void setBoatId(Long boat_id) {
- this.boatId = boat_id;
- }
- public Date getDate() {
- return date;
- }
- public void setDate(Date date) {
- this.date = date;
- }
- public byte getStartHour() {
- return startHour;
- }
- public void setStartHour(byte start_hour) {
- this.startHour = start_hour;
- }
- public byte getEndHour() {
- return endHour;
- }
- public void setEndHour(byte end_hour) {
- this.endHour = end_hour;
- }
- public Bill getBill() {
- return bill;
- }
- public void setBill(Bill bill) {
- this.bill = bill;
- }
- }
|