[e6c2521] | 1 | package com.tourMate.entities;
|
---|
| 2 |
|
---|
| 3 | import com.fasterxml.jackson.annotation.JsonIgnore;
|
---|
| 4 | import jakarta.persistence.*;
|
---|
| 5 |
|
---|
| 6 | import javax.validation.constraints.NotNull;
|
---|
| 7 |
|
---|
| 8 | @Entity
|
---|
| 9 | @Table(name = "restaurant_tables", schema = "public")
|
---|
| 10 | public class RestaurantsTable {
|
---|
| 11 | private long tableId;
|
---|
| 12 | @JsonIgnore
|
---|
| 13 | private Restaurant restaurant;
|
---|
| 14 | private int noSeats;
|
---|
| 15 |
|
---|
| 16 | public RestaurantsTable(Restaurant restaurant, int noSeats) {
|
---|
| 17 | this.restaurant = restaurant;
|
---|
| 18 | this.noSeats = noSeats;
|
---|
| 19 | }
|
---|
| 20 |
|
---|
| 21 | public RestaurantsTable() {
|
---|
| 22 | }
|
---|
| 23 |
|
---|
| 24 | @Id
|
---|
| 25 | @GeneratedValue(strategy = GenerationType.IDENTITY)
|
---|
| 26 | @Column(name = "table_id",unique = true,nullable = false)
|
---|
| 27 | public long getTableId() {
|
---|
| 28 | return tableId;
|
---|
| 29 | }
|
---|
| 30 |
|
---|
| 31 | public void setTableId(long tableId) {
|
---|
| 32 | this.tableId = tableId;
|
---|
| 33 | }
|
---|
| 34 |
|
---|
| 35 | @ManyToOne(fetch = FetchType.LAZY)
|
---|
| 36 | @JoinColumn(name = "restaurant_id", unique = false, nullable = false, foreignKey = @ForeignKey(name = "fk_ref_od_masi_kon_restorani"))
|
---|
| 37 | public Restaurant getRestaurant() {
|
---|
| 38 | return restaurant;
|
---|
| 39 | }
|
---|
| 40 |
|
---|
| 41 | public void setRestaurant(Restaurant restaurant) {
|
---|
| 42 | this.restaurant = restaurant;
|
---|
| 43 | }
|
---|
| 44 |
|
---|
| 45 | @Column(name="no_seats",unique = false,nullable = false)
|
---|
| 46 | @NotNull
|
---|
| 47 | public int getNoSeats() {
|
---|
| 48 | return noSeats;
|
---|
| 49 | }
|
---|
| 50 |
|
---|
| 51 | public void setNoSeats(int noSeats) {
|
---|
| 52 |
|
---|
| 53 | this.noSeats = noSeats;
|
---|
| 54 | }
|
---|
| 55 | }
|
---|