[e6b2246] | 1 | package com.example.moviezone.model;
|
---|
| 2 |
|
---|
[2269653] | 3 | import javax.persistence.*;
|
---|
[e6b2246] | 4 | import lombok.Getter;
|
---|
| 5 | import lombok.Setter;
|
---|
| 6 | import lombok.ToString;
|
---|
| 7 |
|
---|
[2269653] | 8 | import java.math.BigInteger;
|
---|
[eb226b2] | 9 | import java.time.LocalDate;
|
---|
[e6b2246] | 10 | import java.time.LocalDateTime;
|
---|
| 11 |
|
---|
| 12 | @Entity
|
---|
| 13 | @Getter
|
---|
| 14 | @Setter
|
---|
| 15 | @ToString
|
---|
| 16 | @Table(name = "tickets")
|
---|
| 17 | public class Ticket {
|
---|
| 18 |
|
---|
| 19 | @Id
|
---|
| 20 | @GeneratedValue(strategy = GenerationType.IDENTITY)
|
---|
[2269653] | 21 | int id_ticket;
|
---|
[e6b2246] | 22 |
|
---|
[2269653] | 23 | long price;
|
---|
[eb226b2] | 24 | LocalDate date_reserved;
|
---|
[e6b2246] | 25 |
|
---|
| 26 | @ManyToOne
|
---|
[eb226b2] | 27 | @JoinColumn(name = "id_customer")
|
---|
[e6b2246] | 28 | Customer customer;
|
---|
[0ba5d1a] | 29 | @ManyToOne
|
---|
| 30 | @JoinColumn(name = "id_projection")
|
---|
| 31 | Projection projection;
|
---|
| 32 | @ManyToOne
|
---|
| 33 | @JoinColumn(name = "id_discount")
|
---|
| 34 | Discount discount;
|
---|
| 35 | @ManyToOne
|
---|
| 36 | @JoinColumn(name = "id_seat")
|
---|
| 37 | Seat seat;
|
---|
[e6b2246] | 38 |
|
---|
[3242ef4] | 39 | public Ticket(long price, Customer customer) {
|
---|
| 40 | this.price = price;
|
---|
| 41 | this.customer = customer;
|
---|
| 42 | this.date_reserved=LocalDate.now();
|
---|
| 43 | }
|
---|
[e6b2246] | 44 |
|
---|
[00fa72f] | 45 | public Ticket(LocalDate date_reserved, Customer customer, Projection projection, Seat seat) {
|
---|
| 46 | this.date_reserved = date_reserved;
|
---|
| 47 | this.customer = customer;
|
---|
| 48 | this.projection = projection;
|
---|
| 49 | this.seat = seat;
|
---|
| 50 | }
|
---|
| 51 |
|
---|
| 52 | public Ticket( LocalDate date_reserved, Customer customer, Projection projection, Discount discount, Seat seat) {
|
---|
| 53 | this.date_reserved = date_reserved;
|
---|
| 54 | this.customer = customer;
|
---|
| 55 | this.projection = projection;
|
---|
| 56 | this.discount = discount;
|
---|
| 57 | this.seat = seat;
|
---|
| 58 | }
|
---|
| 59 |
|
---|
[3242ef4] | 60 | public Ticket() {
|
---|
[e6b2246] | 61 |
|
---|
[3242ef4] | 62 | }
|
---|
[00fa72f] | 63 |
|
---|
| 64 | public void setPrice(long price) {
|
---|
| 65 | this.price = price;
|
---|
| 66 | }
|
---|
[e6b2246] | 67 | }
|
---|