package com.baris.domain;

import java.util.Date;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

import com.fasterxml.jackson.annotation.JsonFormat;

@Entity
public class Hero {
	
	@Id
	@GeneratedValue
	@Column(name="HERO_ID")
	private Long id;
	
	@Column(name="NAME")
	private String name;
	
	@Column(name="PSEUDONYM")
	private String pseudonym;
	
	@Column(name="PUBLISHER")
	private String publisher;
	
	@OneToMany(cascade=CascadeType.ALL)
	@JoinColumn(name="HERO_ID")
	private Set<Power> powers;
	
	@ManyToOne(optional=true, fetch=FetchType.LAZY)
	@JoinColumn(name="ALLY_ID")
	private Hero ally;
	
	@OneToMany(mappedBy="ally")
	private Set<Hero> allies;
	
	@Column(name="FIRST_APPEARANCE")
	@JsonFormat(pattern="yyyy-MM-dd")
	private Date firstAppearance;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

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

	public String getPseudonym() {
		return pseudonym;
	}

	public void setPseudonym(String pseudonym) {
		this.pseudonym = pseudonym;
	}

	public String getPublisher() {
		return publisher;
	}

	public void setPublisher(String publisher) {
		this.publisher = publisher;
	}

	public Set<Power> getPowers() {
		return powers;
	}

	public void setPowers(Set<Power> powers) {
		this.powers = powers;
	}

	public void setAlly(Hero ally) {
		this.ally = ally;
	}

	public Set<Hero> getAllies() {
		return allies;
	}

	public void setAllies(Set<Hero> allies) {
		this.allies = allies;
	}

	public Date getFirstAppearance() {
		return firstAppearance;
	}

	public void setFirstAppearance(Date firstAppearance) {
		this.firstAppearance = firstAppearance;
	}

	@Override
	public String toString() {
		return "Hero [id=" + id + ", name=" + name + ", pseudonym=" + pseudonym + ", publisher=" + publisher
				+ ", powers=" + powers + ", ally=" + ally + ", allies=" + allies + "]";
	}

}

@@ -174,44 +174,8 @@
 ty;%0A
-import javax.persistence.FetchType;%0A
 impo
@@ -281,44 +281,8 @@
 mn;%0A
-import javax.persistence.ManyToOne;%0A
 impo
@@ -724,132 +724,25 @@
 %09%0A%09@
-ManyToOne(optional=true, fetch=FetchType.LAZY)%0A%09@JoinColumn(name=%22ALLY_ID%22)%0A%09private Hero ally;%0A%09%0A%09@OneToMany(mappedBy=%22ally
+Column(name=%22ALLY
 %22)%0A%09
@@ -750,31 +750,26 @@
 rivate S
-et%3CHero%3E
+tring
  all
-ies
+y
 ;%0A%09%0A%09@Co
@@ -1462,66 +1462,9 @@
 %0A%09%7D%0A
-%0A%09public void setAlly(Hero ally) %7B%0A%09%09this.ally = ally;%0A%09%7D%0A
+%09
 %0A%09pu
@@ -1473,26 +1473,21 @@
 ic S
-et%3CHero%3E
+tring
  getAll
-ies
+y
 () %7B
@@ -1495,27 +1495,25 @@
 %09%09return all
-ies
+y
 ;%0A%09%7D%0A%0A%09publi
@@ -1529,28 +1529,21 @@
 tAll
-ies(Set%3CHero%3E
+y(String
  all
-ies
+y
 ) %7B%0A
@@ -1556,20 +1556,16 @@
 .all
-ies
+y
  = all
-ies
+y
 ;%0A%09%7D
@@ -1931,25 +1931,43 @@
  %22, 
-allies=%22 + allies
+firstAppearance=%22 + firstAppearance
  + %22

Change Hero domain