/*
 * 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.math.BigInteger;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
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.TCUSTLEGALLINK")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tcustlegallink.findAll", query = "SELECT t FROM Tcustlegallink t"),
    @NamedQuery(name = "Tcustlegallink.findByPersoncode", query = "SELECT t FROM Tcustlegallink t WHERE t.tcustlegallinkPK.personcode = :personcode"),
    @NamedQuery(name = "Tcustlegallink.findByLinkpersoncode", query = "SELECT t FROM Tcustlegallink t WHERE t.tcustlegallinkPK.linkpersoncode = :linkpersoncode"),
    @NamedQuery(name = "Tcustlegallink.findByCompanycode", query = "SELECT t FROM Tcustlegallink t WHERE t.tcustlegallinkPK.companycode = :companycode"),
    @NamedQuery(name = "Tcustlegallink.findByDateto", query = "SELECT t FROM Tcustlegallink t WHERE t.tcustlegallinkPK.dateto = :dateto"),
    @NamedQuery(name = "Tcustlegallink.findByDatefrom", query = "SELECT t FROM Tcustlegallink t WHERE t.datefrom = :datefrom"),
    @NamedQuery(name = "Tcustlegallink.findByRecordversion", query = "SELECT t FROM Tcustlegallink t WHERE t.recordversion = :recordversion"),
    @NamedQuery(name = "Tcustlegallink.findByIngressdate", query = "SELECT t FROM Tcustlegallink t WHERE t.ingressdate = :ingressdate"),
    @NamedQuery(name = "Tcustlegallink.findByExitdate", query = "SELECT t FROM Tcustlegallink t WHERE t.exitdate = :exitdate"),
    @NamedQuery(name = "Tcustlegallink.findByIngressuser", query = "SELECT t FROM Tcustlegallink t WHERE t.ingressuser = :ingressuser"),
    @NamedQuery(name = "Tcustlegallink.findByModifyuser", query = "SELECT t FROM Tcustlegallink t WHERE t.modifyuser = :modifyuser")})
public class Tcustlegallink implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TcustlegallinkPK tcustlegallinkPK;
    @Column(name = "DATEFROM")
    @Temporal(TemporalType.TIMESTAMP)
    private Date datefrom;
    @Basic(optional = false)
    @Column(name = "RECORDVERSION")
    private BigInteger recordversion;
    @Column(name = "INGRESSDATE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date ingressdate;
    @Column(name = "EXITDATE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date exitdate;
    @Column(name = "INGRESSUSER")
    private String ingressuser;
    @Column(name = "MODIFYUSER")
    private String modifyuser;
    @JoinColumn(name = "PERSONCODE", referencedColumnName = "PERSONCODE", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Tcustperson tcustperson;
    @JoinColumn(name = "LINKPERSONCODE", referencedColumnName = "PERSONCODE", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Tcustperson tcustperson1;
    @JoinColumns({
        @JoinColumn(name = "LEGALLINKCATALOG", referencedColumnName = "CATALOG"),
        @JoinColumn(name = "LEGALLINKCATALOGCODE", referencedColumnName = "CATALOGCODE")})
    @ManyToOne
    private Tgenecatalogdetail tgenecatalogdetail;
    @JoinColumn(name = "COMPANYCODE", referencedColumnName = "COMPANYCODE", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Tgenecompany tgenecompany;

    public Tcustlegallink() {
    }

    public Tcustlegallink(TcustlegallinkPK tcustlegallinkPK) {
        this.tcustlegallinkPK = tcustlegallinkPK;
    }

    public Tcustlegallink(TcustlegallinkPK tcustlegallinkPK, BigInteger recordversion) {
        this.tcustlegallinkPK = tcustlegallinkPK;
        this.recordversion = recordversion;
    }

    public Tcustlegallink(long personcode, long linkpersoncode, long companycode, Date dateto) {
        this.tcustlegallinkPK = new TcustlegallinkPK(personcode, linkpersoncode, companycode, dateto);
    }

    public TcustlegallinkPK getTcustlegallinkPK() {
        return tcustlegallinkPK;
    }

    public void setTcustlegallinkPK(TcustlegallinkPK tcustlegallinkPK) {
        this.tcustlegallinkPK = tcustlegallinkPK;
    }

    public Date getDatefrom() {
        return datefrom;
    }

    public void setDatefrom(Date datefrom) {
        this.datefrom = datefrom;
    }

    public BigInteger getRecordversion() {
        return recordversion;
    }

    public void setRecordversion(BigInteger recordversion) {
        this.recordversion = recordversion;
    }

    public Date getIngressdate() {
        return ingressdate;
    }

    public void setIngressdate(Date ingressdate) {
        this.ingressdate = ingressdate;
    }

    public Date getExitdate() {
        return exitdate;
    }

    public void setExitdate(Date exitdate) {
        this.exitdate = exitdate;
    }

    public String getIngressuser() {
        return ingressuser;
    }

    public void setIngressuser(String ingressuser) {
        this.ingressuser = ingressuser;
    }

    public String getModifyuser() {
        return modifyuser;
    }

    public void setModifyuser(String modifyuser) {
        this.modifyuser = modifyuser;
    }

    public Tcustperson getTcustperson() {
        return tcustperson;
    }

    public void setTcustperson(Tcustperson tcustperson) {
        this.tcustperson = tcustperson;
    }

    public Tcustperson getTcustperson1() {
        return tcustperson1;
    }

    public void setTcustperson1(Tcustperson tcustperson1) {
        this.tcustperson1 = tcustperson1;
    }

    public Tgenecatalogdetail getTgenecatalogdetail() {
        return tgenecatalogdetail;
    }

    public void setTgenecatalogdetail(Tgenecatalogdetail tgenecatalogdetail) {
        this.tgenecatalogdetail = tgenecatalogdetail;
    }

    public Tgenecompany getTgenecompany() {
        return tgenecompany;
    }

    public void setTgenecompany(Tgenecompany tgenecompany) {
        this.tgenecompany = tgenecompany;
    }

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

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