package cane.brothers.circus.domain;

import javax.persistence.Entity;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.springframework.core.style.ToStringCreator;

@Entity
public class Troupe extends BaseEntity {

	/**
	 * brand name of the troupe.
	 */
	private String name;

	/**
	 * Head of the troupe - responsible person.
	 */
	private String head;

	public Troupe() {
	}

	public Troupe(String name) {
		this.name = name;
	}

	public Troupe(String name, String head) {
		this.name = name;
		this.head = head;
	}

	public String getName() {
		return name;
	}

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

	public String getHead() {
		return head;
	}

	public void setHead(String head) {
		this.head = head;
	}

	@Override
	public int hashCode() {
		return new HashCodeBuilder()
				.appendSuper(super.hashCode())
				.append(this.name)
				.append(this.head)
				.toHashCode();
	}

	@Override
	public boolean equals(final Object obj) {
		if (obj == null) {
			return false;
		}
		if (getClass() != obj.getClass()) {
			return false;
		}
		final Troupe other = (Troupe) obj;
		return new EqualsBuilder()
				.appendSuper(super.equals(obj))
				.append(this.name, other.name)
				.append(this.head, other.head)
				.isEquals();
	}

	@Override
	public String toString() {
		// return String.format("Troupe [id=%s, name=%s, head=%s]", id, name,
		// head);
		return new ToStringCreator(this)
				.append("id", this.getId())
				.append("name", this.name)
				.append("head", this.head)
				.toString();
	}
}

@@ -58,22 +58,135 @@
 istence.
-Entity
+Column;%0D%0Aimport javax.persistence.Entity;%0D%0Aimport javax.persistence.Table;%0D%0Aimport javax.validation.constraints.NotNull
 ;%0D%0A%0D%0Aimp
@@ -363,16 +363,42 @@
 Entity%0D%0A
+@Table(name = %22TROUPES%22)%0D%0A
 public c
@@ -468,32 +468,68 @@
  troupe.%0D%0A%09 */%0D%0A
+%09@NotNull%0D%0A%09@Column(name = %22NAME%22)%0D%0A
 %09private String 
@@ -589,22 +589,50 @@
 erson.%0D%0A
-
 %09 */%0D%0A
+%09@Column(name = %22HEAD_OF%22)%0D%0A
 %09private
@@ -1641,94 +1641,8 @@
  %7B%0D%0A
-%09%09// return String.format(%22Troupe %5Bid=%25s, name=%25s, head=%25s%5D%22, id, name,%0D%0A%09%09// head);%0D%0A
 %09%09re

add validation capitalize