/*
 * 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.TCUSTPERSONBALANCE")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tcustpersonbalance.findAll", query = "SELECT t FROM Tcustpersonbalance t"),
    @NamedQuery(name = "Tcustpersonbalance.findByPersoncode", query = "SELECT t FROM Tcustpersonbalance t WHERE t.tcustpersonbalancePK.personcode = :personcode"),
    @NamedQuery(name = "Tcustpersonbalance.findByBalancedate", query = "SELECT t FROM Tcustpersonbalance t WHERE t.tcustpersonbalancePK.balancedate = :balancedate"),
    @NamedQuery(name = "Tcustpersonbalance.findByBalancecatalog", query = "SELECT t FROM Tcustpersonbalance t WHERE t.tcustpersonbalancePK.balancecatalog = :balancecatalog"),
    @NamedQuery(name = "Tcustpersonbalance.findByBalancecatalogcode", query = "SELECT t FROM Tcustpersonbalance t WHERE t.tcustpersonbalancePK.balancecatalogcode = :balancecatalogcode"),
    @NamedQuery(name = "Tcustpersonbalance.findByDateto", query = "SELECT t FROM Tcustpersonbalance t WHERE t.tcustpersonbalancePK.dateto = :dateto"),
    @NamedQuery(name = "Tcustpersonbalance.findByDatefrom", query = "SELECT t FROM Tcustpersonbalance t WHERE t.datefrom = :datefrom"),
    @NamedQuery(name = "Tcustpersonbalance.findByIngressuser", query = "SELECT t FROM Tcustpersonbalance t WHERE t.ingressuser = :ingressuser"),
    @NamedQuery(name = "Tcustpersonbalance.findByModifyuser", query = "SELECT t FROM Tcustpersonbalance t WHERE t.modifyuser = :modifyuser"),
    @NamedQuery(name = "Tcustpersonbalance.findByRecordversion", query = "SELECT t FROM Tcustpersonbalance t WHERE t.recordversion = :recordversion")})
public class Tcustpersonbalance implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TcustpersonbalancePK tcustpersonbalancePK;
    @Column(name = "DATEFROM")
    @Temporal(TemporalType.TIMESTAMP)
    private Date datefrom;
    @Column(name = "INGRESSUSER")
    private String ingressuser;
    @Column(name = "MODIFYUSER")
    private String modifyuser;
    @Column(name = "RECORDVERSION")
    private BigInteger recordversion;
    @JoinColumns({
        @JoinColumn(name = "PERSONCODE", referencedColumnName = "PERSONCODE", insertable = false, updatable = false),
        @JoinColumn(name = "BALANCEDATE", referencedColumnName = "BALANCEDATE", insertable = false, updatable = false)})
    @ManyToOne(optional = false)
    private Tcustbalance tcustbalance;
    @JoinColumns({
        @JoinColumn(name = "STATUSCATALOG", referencedColumnName = "CATALOG"),
        @JoinColumn(name = "STATUSCATALOGCODE", referencedColumnName = "CATALOGCODE")})
    @ManyToOne
    private Tgenecatalogdetail tgenecatalogdetail;
    @JoinColumns({
        @JoinColumn(name = "BALANCECATALOG", referencedColumnName = "CATALOG", insertable = false, updatable = false),
        @JoinColumn(name = "BALANCECATALOGCODE", referencedColumnName = "CATALOGCODE", insertable = false, updatable = false)})
    @ManyToOne(optional = false)
    private Tgenecatalogdetail tgenecatalogdetail1;
    @JoinColumn(name = "COMPANYCODE", referencedColumnName = "COMPANYCODE")
    @ManyToOne
    private Tgenecompany companycode;
    @JoinColumn(name = "CURRENCYCODE", referencedColumnName = "CURRENCYCODE")
    @ManyToOne
    private Tgenecurrency currencycode;
    @JoinColumn(name = "CODE", referencedColumnName = "CODE")
    @ManyToOne
    private Tgenefiles code;

    public Tcustpersonbalance() {
    }

    public Tcustpersonbalance(TcustpersonbalancePK tcustpersonbalancePK) {
        this.tcustpersonbalancePK = tcustpersonbalancePK;
    }

    public Tcustpersonbalance(long personcode, Date balancedate, String balancecatalog, String balancecatalogcode, Date dateto) {
        this.tcustpersonbalancePK = new TcustpersonbalancePK(personcode, balancedate, balancecatalog, balancecatalogcode, dateto);
    }

    public TcustpersonbalancePK getTcustpersonbalancePK() {
        return tcustpersonbalancePK;
    }

    public void setTcustpersonbalancePK(TcustpersonbalancePK tcustpersonbalancePK) {
        this.tcustpersonbalancePK = tcustpersonbalancePK;
    }

    public Date getDatefrom() {
        return datefrom;
    }

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

    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 BigInteger getRecordversion() {
        return recordversion;
    }

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

    public Tcustbalance getTcustbalance() {
        return tcustbalance;
    }

    public void setTcustbalance(Tcustbalance tcustbalance) {
        this.tcustbalance = tcustbalance;
    }

    public Tgenecatalogdetail getTgenecatalogdetail() {
        return tgenecatalogdetail;
    }

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

    public Tgenecatalogdetail getTgenecatalogdetail1() {
        return tgenecatalogdetail1;
    }

    public void setTgenecatalogdetail1(Tgenecatalogdetail tgenecatalogdetail1) {
        this.tgenecatalogdetail1 = tgenecatalogdetail1;
    }

    public Tgenecompany getCompanycode() {
        return companycode;
    }

    public void setCompanycode(Tgenecompany companycode) {
        this.companycode = companycode;
    }

    public Tgenecurrency getCurrencycode() {
        return currencycode;
    }

    public void setCurrencycode(Tgenecurrency currencycode) {
        this.currencycode = currencycode;
    }

    public Tgenefiles getCode() {
        return code;
    }

    public void setCode(Tgenefiles code) {
        this.code = code;
    }

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

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