/*
 * 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 java.util.Date;
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.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author developer2
 */
@Entity
@Table(name="COMACO.TARMTAGARMA")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tarmtagarma.findAll", query = "SELECT t FROM Tarmtagarma t"),
    @NamedQuery(name = "Tarmtagarma.findByCarma", query = "SELECT t FROM Tarmtagarma t WHERE t.tarmtagarmaPK.carma = :carma"),
    @NamedQuery(name = "Tarmtagarma.findByCtag", query = "SELECT t FROM Tarmtagarma t WHERE t.tarmtagarmaPK.ctag = :ctag"),
    @NamedQuery(name = "Tarmtagarma.findByFecha", query = "SELECT t FROM Tarmtagarma t WHERE t.fecha = :fecha")})
public class Tarmtagarma implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TarmtagarmaPK tarmtagarmaPK;
    @Column(name = "FECHA")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecha;
    @JoinColumn(name = "CARMA", referencedColumnName = "CARMA", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Tarmarmas tarmarmas;

    public Tarmtagarma() {
    }

    public Tarmtagarma(TarmtagarmaPK tarmtagarmaPK) {
        this.tarmtagarmaPK = tarmtagarmaPK;
    }

    public Tarmtagarma(String carma, String ctag) {
        this.tarmtagarmaPK = new TarmtagarmaPK(carma, ctag);
    }

    public TarmtagarmaPK getTarmtagarmaPK() {
        return tarmtagarmaPK;
    }

    public void setTarmtagarmaPK(TarmtagarmaPK tarmtagarmaPK) {
        this.tarmtagarmaPK = tarmtagarmaPK;
    }

    public Date getFecha() {
        return fecha;
    }

    public void setFecha(Date fecha) {
        this.fecha = fecha;
    }

    public Tarmarmas getTarmarmas() {
        return tarmarmas;
    }

    public void setTarmarmas(Tarmarmas tarmarmas) {
        this.tarmarmas = tarmarmas;
    }

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

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