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; } }