package com.c09.GoMovie.cinema.entities;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;

import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonIgnore;

@Entity
public class Seat {
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	private long id;
	
	@NotNull
	@Min(value=0)
	@Max(value=1000)
	@Column(nullable=false)
	private Integer row;
	
	@NotNull
	@Min(value=0)
	@Max(value=1000)
	@Column(nullable=false)
	private Integer col;
	
	@ManyToOne(cascade = { CascadeType.MERGE,CascadeType.REFRESH }, optional = false)
    @JoinColumn(name="hall_id")
	private Hall hall;
	
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}
	
	public Integer getRow() {
		return row;
	}
	
	public void setRow(Integer row) {
		this.row = row;
	}
	
	public Integer getCol() {
		return col;
	}
	
	public void setCol(Integer col) {
		this.col = col;
	}
	
	@JsonBackReference
	public Hall getHall() {
		return hall;
	}
	
	@JsonIgnore
	public void setHall(Hall hall) {
		this.hall = hall;
	}
	
}
@@ -35,16 +35,68 @@
 ities;%0A%0A
+import java.util.ArrayList;%0Aimport java.util.List;%0A%0A
 import j
@@ -121,24 +121,24 @@
 ascadeType;%0A
-
 import javax
@@ -191,16 +191,52 @@
 Entity;%0A
+import javax.persistence.FetchType;%0A
 import j
@@ -411,16 +411,87 @@
 yToOne;%0A
+import javax.persistence.OneToMany;%0Aimport javax.persistence.OneToOne;%0A
 import j
@@ -610,16 +610,115 @@
 tNull;%0A%0A
+import com.c09.GoMovie.product.entities.Screening;%0Aimport com.c09.GoMovie.product.entities.Ticket;%0A
 import c
@@ -1678,9 +1678,301 @@
 l;%0A%09%7D%0A%09%0A
+%09@OneToOne(cascade = CascadeType.ALL, mappedBy = %22seat%22, fetch = FetchType.LAZY)    %0A%09@JoinColumn(name=%22ticket_id%22)%0A%09private Ticket ticket;%0A%09%0A%09@JsonBackReference%0A%09public Ticket getTicket() %7B%0A%09%09return ticket;%0A%09%7D%0A%0A%09@JsonIgnore%0A%09public void setTicket(Ticket ticket) %7B%0A%09%09this.ticket = ticket;%0A%09%7D%0A
 %7D

add ticket property