/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.qsoft.rs.sincoar.model;

import java.io.Serializable;
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.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author developer2
 */
@Entity
@Table(name="COMACO.TARMLECTURADETALLE")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tarmlecturadetalle.findAll", query = "SELECT t FROM Tarmlecturadetalle t"),
    @NamedQuery(name = "Tarmlecturadetalle.findByClectura", query = "SELECT t FROM Tarmlecturadetalle t WHERE t.tarmlecturadetallePK.clectura = :clectura"),
    @NamedQuery(name = "Tarmlecturadetalle.findByCodigotag", query = "SELECT t FROM Tarmlecturadetalle t WHERE t.tarmlecturadetallePK.codigotag = :codigotag")})
public class Tarmlecturadetalle implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TarmlecturadetallePK tarmlecturadetallePK;
    @JoinColumn(name = "CLECTURA", referencedColumnName = "CLECTURA", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Tarmlectura tarmlectura;

    public Tarmlecturadetalle() {
    }

    public Tarmlecturadetalle(TarmlecturadetallePK tarmlecturadetallePK) {
        this.tarmlecturadetallePK = tarmlecturadetallePK;
    }

    public Tarmlecturadetalle(long clectura, String codigotag) {
        this.tarmlecturadetallePK = new TarmlecturadetallePK(clectura, codigotag);
    }

    public TarmlecturadetallePK getTarmlecturadetallePK() {
        return tarmlecturadetallePK;
    }

    public void setTarmlecturadetallePK(TarmlecturadetallePK tarmlecturadetallePK) {
        this.tarmlecturadetallePK = tarmlecturadetallePK;
    }

    public Tarmlectura getTarmlectura() {
        return tarmlectura;
    }

    public void setTarmlectura(Tarmlectura tarmlectura) {
        this.tarmlectura = tarmlectura;
    }

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

    @Override
    public String toString() {
        return "com.qsoft.rs.sincoar.model.Tarmlecturadetalle[ tarmlecturadetallePK=" + tarmlecturadetallePK + " ]";
    }
    
}
