/*
 * 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.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.TCUSTPEOPLEASSOCIATION")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tcustpeopleassociation.findAll", query = "SELECT t FROM Tcustpeopleassociation t"),
    @NamedQuery(name = "Tcustpeopleassociation.findByPersoncode", query = "SELECT t FROM Tcustpeopleassociation t WHERE t.tcustpeopleassociationPK.personcode = :personcode"),
    @NamedQuery(name = "Tcustpeopleassociation.findByDateto", query = "SELECT t FROM Tcustpeopleassociation t WHERE t.tcustpeopleassociationPK.dateto = :dateto"),
    @NamedQuery(name = "Tcustpeopleassociation.findByAssociationsequence", query = "SELECT t FROM Tcustpeopleassociation t WHERE t.tcustpeopleassociationPK.associationsequence = :associationsequence"),
    @NamedQuery(name = "Tcustpeopleassociation.findByDatefrom", query = "SELECT t FROM Tcustpeopleassociation t WHERE t.datefrom = :datefrom"),
    @NamedQuery(name = "Tcustpeopleassociation.findByRecordversion", query = "SELECT t FROM Tcustpeopleassociation t WHERE t.recordversion = :recordversion"),
    @NamedQuery(name = "Tcustpeopleassociation.findByAssociationname", query = "SELECT t FROM Tcustpeopleassociation t WHERE t.associationname = :associationname"),
    @NamedQuery(name = "Tcustpeopleassociation.findByAssociationcode", query = "SELECT t FROM Tcustpeopleassociation t WHERE t.associationcode = :associationcode"),
    @NamedQuery(name = "Tcustpeopleassociation.findByIngressuser", query = "SELECT t FROM Tcustpeopleassociation t WHERE t.ingressuser = :ingressuser"),
    @NamedQuery(name = "Tcustpeopleassociation.findByModifyuser", query = "SELECT t FROM Tcustpeopleassociation t WHERE t.modifyuser = :modifyuser")})
public class Tcustpeopleassociation implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TcustpeopleassociationPK tcustpeopleassociationPK;
    @Column(name = "DATEFROM")
    @Temporal(TemporalType.TIMESTAMP)
    private Date datefrom;
    @Column(name = "RECORDVERSION")
    private BigInteger recordversion;
    @Column(name = "ASSOCIATIONNAME")
    private String associationname;
    @Column(name = "ASSOCIATIONCODE")
    private String associationcode;
    @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 = "ASSOCIATIONPERSONCODE", referencedColumnName = "PERSONCODE")
    @ManyToOne
    private Tcustperson associationpersoncode;

    public Tcustpeopleassociation() {
    }

    public Tcustpeopleassociation(TcustpeopleassociationPK tcustpeopleassociationPK) {
        this.tcustpeopleassociationPK = tcustpeopleassociationPK;
    }

    public Tcustpeopleassociation(long personcode, Date dateto, short associationsequence) {
        this.tcustpeopleassociationPK = new TcustpeopleassociationPK(personcode, dateto, associationsequence);
    }

    public TcustpeopleassociationPK getTcustpeopleassociationPK() {
        return tcustpeopleassociationPK;
    }

    public void setTcustpeopleassociationPK(TcustpeopleassociationPK tcustpeopleassociationPK) {
        this.tcustpeopleassociationPK = tcustpeopleassociationPK;
    }

    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 getAssociationname() {
        return associationname;
    }

    public void setAssociationname(String associationname) {
        this.associationname = associationname;
    }

    public String getAssociationcode() {
        return associationcode;
    }

    public void setAssociationcode(String associationcode) {
        this.associationcode = associationcode;
    }

    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 getAssociationpersoncode() {
        return associationpersoncode;
    }

    public void setAssociationpersoncode(Tcustperson associationpersoncode) {
        this.associationpersoncode = associationpersoncode;
    }

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

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