/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.pepe.jpa.entities; import java.io.Serializable; import java.util.List; import javax.persistence.Basic; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Lob; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.OneToMany; import javax.persistence.Table; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlTransient; /** * * @author Junior Cabal */ @Entity @Table(name = "eps") @XmlRootElement @NamedQueries({ @NamedQuery(name = "Eps.findAll", query = "SELECT e FROM Eps e"), @NamedQuery(name = "Eps.findByIdEps", query = "SELECT e FROM Eps e WHERE e.idEps = :idEps")}) public class Eps implements Serializable { private static final long serialVersionUID = 1L; @Id @Basic(optional = false) @NotNull @Size(min = 1, max = 20) @Column(name = "id_eps") private String idEps; @Basic(optional = false) @NotNull @Lob @Size(min = 1, max = 65535) @Column(name = "nombre_eps") private String nombreEps; @OneToMany(cascade = CascadeType.ALL, mappedBy = "idEps") private List<Usuario> usuarioList; public Eps() { } public Eps(String idEps) { this.idEps = idEps; } public Eps(String idEps, String nombreEps) { this.idEps = idEps; this.nombreEps = nombreEps; } public String getIdEps() { return idEps; } public void setIdEps(String idEps) { this.idEps = idEps; } public String getNombreEps() { return nombreEps; } public void setNombreEps(String nombreEps) { this.nombreEps = nombreEps; } @XmlTransient public List<Usuario> getUsuarioList() { return usuarioList; } public void setUsuarioList(List<Usuario> usuarioList) { this.usuarioList = usuarioList; } @Override public int hashCode() { int hash = 0; hash += (idEps != null ? idEps.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Eps)) { return false; } Eps other = (Eps) object; if ((this.idEps == null && other.idEps != null) || (this.idEps != null && !this.idEps.equals(other.idEps))) { return false; } return true; } @Override public String toString() { return "com.pepe.jpa.entities.Eps[ idEps=" + idEps + " ]"; } }