/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package mx.edu.um.mateo.colportor.model; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import java.util.Objects; import javax.persistence.*; import org.hibernate.validator.constraints.NotBlank; /** * * @author gibrandemetrioo */ @Entity @Table(name = "estados") public class Estado implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Version private Integer version; @NotBlank @Column(length= 128) private String nombre; @ManyToOne private Pais pais; public Estado (){ } public Estado (Pais pais){ this.pais = pais; } public Estado (String nombre){ this.nombre = nombre; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getNombre() { return nombre; } public void setNombre(String nombre) { this.nombre = nombre; } public Integer getVersion() { return version; } public void setVersion(Integer version) { this.version = version; } public Pais getPais() { return pais; } public void setPais(Pais pais) { this.pais = pais; } @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Estado other = (Estado) obj; if (!Objects.equals(this.nombre, other.nombre)) { return false; } return true; } @Override public int hashCode() { int hash = 7; hash = 19 * hash + Objects.hashCode(this.nombre); return hash; } @Override public String toString() { return "Estado{" + "nombre=" + nombre + '}'; } }