/*
 * 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.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.TCUSTPERSONPERSONALREFERENCE")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tcustpersonpersonalreference.findAll", query = "SELECT t FROM Tcustpersonpersonalreference t"),
    @NamedQuery(name = "Tcustpersonpersonalreference.findByPersoncode", query = "SELECT t FROM Tcustpersonpersonalreference t WHERE t.tcustpersonpersonalreferencePK.personcode = :personcode"),
    @NamedQuery(name = "Tcustpersonpersonalreference.findByReferencesequence", query = "SELECT t FROM Tcustpersonpersonalreference t WHERE t.tcustpersonpersonalreferencePK.referencesequence = :referencesequence"),
    @NamedQuery(name = "Tcustpersonpersonalreference.findByDateto", query = "SELECT t FROM Tcustpersonpersonalreference t WHERE t.tcustpersonpersonalreferencePK.dateto = :dateto"),
    @NamedQuery(name = "Tcustpersonpersonalreference.findByDatefrom", query = "SELECT t FROM Tcustpersonpersonalreference t WHERE t.datefrom = :datefrom"),
    @NamedQuery(name = "Tcustpersonpersonalreference.findByRecordversion", query = "SELECT t FROM Tcustpersonpersonalreference t WHERE t.recordversion = :recordversion"),
    @NamedQuery(name = "Tcustpersonpersonalreference.findByName", query = "SELECT t FROM Tcustpersonpersonalreference t WHERE t.name = :name"),
    @NamedQuery(name = "Tcustpersonpersonalreference.findByRemark", query = "SELECT t FROM Tcustpersonpersonalreference t WHERE t.remark = :remark")})
public class Tcustpersonpersonalreference implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TcustpersonpersonalreferencePK tcustpersonpersonalreferencePK;
    @Column(name = "DATEFROM")
    @Temporal(TemporalType.TIMESTAMP)
    private Date datefrom;
    @Column(name = "RECORDVERSION")
    private BigInteger recordversion;
    @Column(name = "NAME")
    private String name;
    @Column(name = "REMARK")
    private String remark;
    @JoinColumn(name = "PERSONCODE", referencedColumnName = "PERSONCODE", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Tcustperson tcustperson;
    @JoinColumn(name = "REFERENCEPERSONCODE", referencedColumnName = "PERSONCODE")
    @ManyToOne
    private Tcustperson referencepersoncode;
    @JoinColumns({
        @JoinColumn(name = "PERSONALREFCATALOG", referencedColumnName = "CATALOG"),
        @JoinColumn(name = "PERSONALREFCATALOGCODE", referencedColumnName = "CATALOGCODE")})
    @ManyToOne
    private Tgenecatalogdetail tgenecatalogdetail;
    @JoinColumn(name = "MODIFYUSERCODE", referencedColumnName = "USERCODE")
    @ManyToOne
    private Tsafeuser modifyusercode;
    @JoinColumn(name = "INGRESSUSERCODE", referencedColumnName = "USERCODE")
    @ManyToOne
    private Tsafeuser ingressusercode;

    public Tcustpersonpersonalreference() {
    }

    public Tcustpersonpersonalreference(TcustpersonpersonalreferencePK tcustpersonpersonalreferencePK) {
        this.tcustpersonpersonalreferencePK = tcustpersonpersonalreferencePK;
    }

    public Tcustpersonpersonalreference(long personcode, short referencesequence, Date dateto) {
        this.tcustpersonpersonalreferencePK = new TcustpersonpersonalreferencePK(personcode, referencesequence, dateto);
    }

    public TcustpersonpersonalreferencePK getTcustpersonpersonalreferencePK() {
        return tcustpersonpersonalreferencePK;
    }

    public void setTcustpersonpersonalreferencePK(TcustpersonpersonalreferencePK tcustpersonpersonalreferencePK) {
        this.tcustpersonpersonalreferencePK = tcustpersonpersonalreferencePK;
    }

    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 String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Tcustperson getTcustperson() {
        return tcustperson;
    }

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

    public Tcustperson getReferencepersoncode() {
        return referencepersoncode;
    }

    public void setReferencepersoncode(Tcustperson referencepersoncode) {
        this.referencepersoncode = referencepersoncode;
    }

    public Tgenecatalogdetail getTgenecatalogdetail() {
        return tgenecatalogdetail;
    }

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

    public Tsafeuser getModifyusercode() {
        return modifyusercode;
    }

    public void setModifyusercode(Tsafeuser modifyusercode) {
        this.modifyusercode = modifyusercode;
    }

    public Tsafeuser getIngressusercode() {
        return ingressusercode;
    }

    public void setIngressusercode(Tsafeuser ingressusercode) {
        this.ingressusercode = ingressusercode;
    }

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

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