/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package empresa.negocio; import com.tecgraf.dao.IEntityDAOJPA; import java.io.Serializable; import java.util.Collection; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.ManyToMany; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.Table; /** * * @author s092 */ @Entity @Table(name = "projeto") @NamedQueries({@NamedQuery(name = "Projeto.findById", query = "SELECT p FROM Projeto p WHERE p.id = :id"), @NamedQuery(name = "Projeto.findBySigla", query = "SELECT p FROM Projeto p WHERE p.sigla = :sigla"), @NamedQuery(name = "Projeto.findByNome", query = "SELECT p FROM Projeto p WHERE p.nome = :nome")}) public class Projeto implements IEntityDAOJPA, Serializable { private static final long serialVersionUID = 1L; @Id @Column(name = "id", nullable = false) private Integer id; @Column(name = "sigla", nullable = false) private String sigla; @Column(name = "nome") private String nome; @ManyToMany(mappedBy = "idprojetoCollection") private Collection empregadoCollection; public Projeto() { } public Projeto( Integer id ) { this.id = id; } public Projeto( Integer id, String sigla ) { this.id = id; this.sigla = sigla; } public Integer getId() { return id; } public void setId( Integer id ) { this.id = id; } public String getSigla() { return sigla; } public void setSigla( String sigla ) { this.sigla = sigla; } public String getNome() { return nome; } public void setNome( String nome ) { this.nome = nome; } public Collection getEmpregadoCollection() { return empregadoCollection; } public void setEmpregadoCollection( Collection empregadoCollection ) { this.empregadoCollection = empregadoCollection; } @Override public int hashCode() { int hash = 0; hash += (id != null ? id.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 Projeto) ) { return false; } Projeto other = (Projeto)object; if( (this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id)) ) { return false; } return true; } @Override public String toString() { return "empresa.negocio.Projeto["+ id + " " + nome.trim() + "]: " + " sigla: " + sigla.trim() + " " + " - equipeProjeto: " + empregadoCollection; } }