/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package negocio;

import com.tecgraf.dao.IEntityDAOJPA;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author 42071420687
 */
@Entity
@Table(name = "disciplina")
@NamedQueries({@NamedQuery(name = "Disciplina.findById", query = "SELECT d FROM Disciplina d WHERE d.id = :id"), 
@NamedQuery(name = "Disciplina.findByCodigo", query = "SELECT d FROM Disciplina d WHERE d.codigo = :codigo"), 
@NamedQuery(name = "Disciplina.findByNome", query = "SELECT d FROM Disciplina d WHERE d.nome = :nome")})
public class Disciplina implements IEntityDAOJPA<Integer>, Serializable {
    private static final long serialVersionUID = 1L;
    @Id  @Column(name = "id", nullable = false)
    private Integer id;
    @Column(name = "codigo")
    private String codigo;
    @Column(name = "nome")
    private String nome;
    
    @JoinColumn(name = "idaluno", referencedColumnName = "id")
    @ManyToOne
    private Aluno idAluno;

    public Disciplina() {
    }

    public Integer getId() {
        return id;
    }

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

    public String getCodigo() {
        return codigo;
    }

    public void setCodigo(String codigo) {
        this.codigo = codigo;
    }

    public String getNome() {
        return nome;
    }

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

    public Aluno getIdAluno() {
        return idAluno;
    }

    public void setIdAluno(Aluno idaluno) {
        this.idAluno = idaluno;
    }

    @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 Disciplina)) {
            return false;
        }
        Disciplina other = (Disciplina) 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 "negocio.Disciplina[id=" + id + " codigo="+ codigo + " nome="+ nome +"]";
    }

}
