/*
 * 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.cosmodas.EntCosmos;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author obper
 */
@Entity
@Table(name = "detalle_remision", catalog = "dbcosmodas", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "DetalleRemision.findAll", query = "SELECT d FROM DetalleRemision d"),
    @NamedQuery(name = "DetalleRemision.findByNotareCodigo", query = "SELECT d FROM DetalleRemision d WHERE d.detalleRemisionPK.notareCodigo = :notareCodigo"),
    @NamedQuery(name = "DetalleRemision.findByNotareCantidad", query = "SELECT d FROM DetalleRemision d WHERE d.notareCantidad = :notareCantidad"),
    @NamedQuery(name = "DetalleRemision.findByProductoCodigo", query = "SELECT d FROM DetalleRemision d WHERE d.detalleRemisionPK.productoCodigo = :productoCodigo"),
    @NamedQuery(name = "DetalleRemision.findByNotareTipo", query = "SELECT d FROM DetalleRemision d WHERE d.detalleRemisionPK.notareTipo = :notareTipo")})
public class DetalleRemision implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected DetalleRemisionPK detalleRemisionPK;
    @Basic(optional = false)
    @NotNull
    @Column(name = "notare_cantidad")
    private Integer notareCantidad;

    public DetalleRemision() {
    }

    public DetalleRemision(DetalleRemisionPK detalleRemisionPK) {
        this.detalleRemisionPK = detalleRemisionPK;
    }

    public DetalleRemision(DetalleRemisionPK detalleRemisionPK, Integer notareCantidad) {
        this.detalleRemisionPK = detalleRemisionPK;
        this.notareCantidad = notareCantidad;
    }

    public DetalleRemision(String notareCodigo, String productoCodigo, String notareTipo) {
        this.detalleRemisionPK = new DetalleRemisionPK(notareCodigo, productoCodigo, notareTipo);
    }

    public DetalleRemisionPK getDetalleRemisionPK() {
        return detalleRemisionPK;
    }

    public void setDetalleRemisionPK(DetalleRemisionPK detalleRemisionPK) {
        this.detalleRemisionPK = detalleRemisionPK;
    }

    public Integer getNotareCantidad() {
        return notareCantidad;
    }

    public void setNotareCantidad(Integer notareCantidad) {
        this.notareCantidad = notareCantidad;
    }


    @Override
    public int hashCode() {
        int hash = 0;
        hash += (detalleRemisionPK != null ? detalleRemisionPK.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 DetalleRemision)) {
            return false;
        }
        DetalleRemision other = (DetalleRemision) object;
        if ((this.detalleRemisionPK == null && other.detalleRemisionPK != null) || (this.detalleRemisionPK != null && !this.detalleRemisionPK.equals(other.detalleRemisionPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.cosmodas.EntCosmos.DetalleRemision[ detalleRemisionPK=" + detalleRemisionPK + " ]";
    }
    
}
