package br.com.fsp.wine.model;

import java.math.BigDecimal;

import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name = "vinho")
public class Vinho {

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Long id;

	private String nome;
	
	@Enumerated(EnumType.STRING)
	private TipoVinho tipo;
	private Integer safra;
	private Integer volume;
	private BigDecimal valor;

	public Long getId() {
		return id;
	}

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

	public String getNome() {
		return nome;
	}

	public void setNome(String nome) {
		this.nome = nome;
	}

	public TipoVinho getTipo() {
		return tipo;
	}

	public void setTipo(TipoVinho tipo) {
		this.tipo = tipo;
	}

	public Integer getSafra() {
		return safra;
	}

	public void setSafra(Integer safra) {
		this.safra = safra;
	}

	public Integer getVolume() {
		return volume;
	}

	public void setVolume(Integer volume) {
		this.volume = volume;
	}

	public BigDecimal getValor() {
		return valor;
	}

	public void setValor(BigDecimal valor) {
		this.valor = valor;
	}

}

@@ -429,18 +429,22 @@
 te Long 
-id
+codigo
 ;%0A%0A%09priv
@@ -460,17 +460,16 @@
 g nome;%0A
-%09
 %0A%09@Enume
@@ -609,18 +609,22 @@
 Long get
-Id
+Codigo
 () %7B%0A%09%09r
@@ -629,18 +629,22 @@
 %09return 
-id
+codigo
 ;%0A%09%7D%0A%0A%09p
@@ -661,36 +661,52 @@
  set
-Id(Long id) %7B%0A%09%09this.id = id
+Codigo(Long codigo) %7B%0A%09%09this.codigo = codigo
 ;%0A%09%7D
@@ -1279,10 +1279,532 @@
 or;%0A%09%7D%0A%0A
+%09@Override%0A%09public int hashCode() %7B%0A%09%09final int prime = 31;%0A%09%09int result = 1;%0A%09%09result = prime * result + ((codigo == null) ? 0 : codigo.hashCode());%0A%09%09return result;%0A%09%7D%0A%0A%09@Override%0A%09public boolean equals(Object obj) %7B%0A%09%09if (this == obj)%0A%09%09%09return true;%0A%09%09if (obj == null)%0A%09%09%09return false;%0A%09%09if (getClass() != obj.getClass())%0A%09%09%09return false;%0A%09%09Vinho other = (Vinho) obj;%0A%09%09if (codigo == null) %7B%0A%09%09%09if (other.codigo != null)%0A%09%09%09%09return false;%0A%09%09%7D else if (!codigo.equals(other.codigo))%0A%09%09%09return false;%0A%09%09return true;%0A%09%7D%0A%0A
 %7D%0A

fix #21, Correção view cadastrar vinho.