package cane.brothers.circus.domain;

import javax.persistence.Entity;
import javax.persistence.Table;

@Entity
@Table(name = "SECTORS")
public class Sector extends BaseEntity {

	/**
	 * The short name of the sector, may be a code such as S1, S2, etc.
	 */
	private String name;

	/**
	 * The description of the section, such as 'Rear Balcony', etc.
	 */
	private String description;

	/**
	 * The total seating capacity of the sector
	 */
	private int capacity;

	/**
	 * Left or right side to which this sector belongs
	 */	
	private Side side;

	/**
	 * The layout to which this sector belongs
	 */
	private CircusLayout layout;

	public Sector() {
	}

	public String getName() {
		return name;
	}

	public String getDescription() {
		return description;
	}

	public int getCapacity() {
		return capacity;
	}

	public Side getSide() {
		return side;
	}

	public CircusLayout getLayout() {
		return layout;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public void setCapacity(int capacity) {
		this.capacity = capacity;
	}

	public void setSide(Side side) {
		this.side = side;
	}

	public void setLayout(CircusLayout layout) {
		this.layout = layout;
	}

}

@@ -64,16 +64,125 @@
 Entity;%0A
+import javax.persistence.FetchType;%0Aimport javax.persistence.JoinColumn;%0Aimport javax.persistence.ManyToOne;%0A
 import j
@@ -710,56 +710,447 @@
 */%0A%09
-private CircusLayout layout;%0A%0A%09public Sector() %7B
+@ManyToOne(fetch = FetchType.LAZY, optional = false)%0A%09@JoinColumn(name = %22LAYOUT_ID%22, unique = true, nullable = false)%0A%09private CircusLayout layout;%0A%0A%09/**%0A%09 * Default constructor%0A%09 */%0A%09public Sector() %7B%0A%09%7D%0A%0A%09public Sector(String name, String description, int capacity, Side side, CircusLayout layout) %7B%0A%09%09super();%0A%09%09this.name = name;%0A%09%09this.description = description;%0A%09%09this.capacity = capacity;%0A%09%09this.side = side;%0A%09%09this.layout = layout;
 %0A%09%7D%0A

connect with layout