/*
 * 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.TCUSTPERSONBANKREFERENCE")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tcustpersonbankreference.findAll", query = "SELECT t FROM Tcustpersonbankreference t"),
    @NamedQuery(name = "Tcustpersonbankreference.findByPersoncode", query = "SELECT t FROM Tcustpersonbankreference t WHERE t.tcustpersonbankreferencePK.personcode = :personcode"),
    @NamedQuery(name = "Tcustpersonbankreference.findByReferencesequence", query = "SELECT t FROM Tcustpersonbankreference t WHERE t.tcustpersonbankreferencePK.referencesequence = :referencesequence"),
    @NamedQuery(name = "Tcustpersonbankreference.findByDateto", query = "SELECT t FROM Tcustpersonbankreference t WHERE t.tcustpersonbankreferencePK.dateto = :dateto"),
    @NamedQuery(name = "Tcustpersonbankreference.findByDatefrom", query = "SELECT t FROM Tcustpersonbankreference t WHERE t.datefrom = :datefrom"),
    @NamedQuery(name = "Tcustpersonbankreference.findByRecordversion", query = "SELECT t FROM Tcustpersonbankreference t WHERE t.recordversion = :recordversion"),
    @NamedQuery(name = "Tcustpersonbankreference.findByName", query = "SELECT t FROM Tcustpersonbankreference t WHERE t.name = :name"),
    @NamedQuery(name = "Tcustpersonbankreference.findByAccountnumber", query = "SELECT t FROM Tcustpersonbankreference t WHERE t.accountnumber = :accountnumber"),
    @NamedQuery(name = "Tcustpersonbankreference.findByFiguresnumber", query = "SELECT t FROM Tcustpersonbankreference t WHERE t.figuresnumber = :figuresnumber"),
    @NamedQuery(name = "Tcustpersonbankreference.findByOpeningdate", query = "SELECT t FROM Tcustpersonbankreference t WHERE t.openingdate = :openingdate"),
    @NamedQuery(name = "Tcustpersonbankreference.findByRemark", query = "SELECT t FROM Tcustpersonbankreference t WHERE t.remark = :remark")})
public class Tcustpersonbankreference implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TcustpersonbankreferencePK tcustpersonbankreferencePK;
    @Column(name = "DATEFROM")
    @Temporal(TemporalType.TIMESTAMP)
    private Date datefrom;
    @Column(name = "RECORDVERSION")
    private BigInteger recordversion;
    @Column(name = "NAME")
    private String name;
    @Column(name = "ACCOUNTNUMBER")
    private String accountnumber;
    @Column(name = "FIGURESNUMBER")
    private Short figuresnumber;
    @Column(name = "OPENINGDATE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date openingdate;
    @Column(name = "REMARK")
    private String remark;
    @JoinColumn(name = "PERSONCODE", referencedColumnName = "PERSONCODE", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Tcustperson tcustperson;
    @JoinColumn(name = "BANKPERSONCODE", referencedColumnName = "PERSONCODE")
    @ManyToOne
    private Tcustperson bankpersoncode;
    @JoinColumns({
        @JoinColumn(name = "ACCOUNTTYPECATALOG", referencedColumnName = "CATALOG"),
        @JoinColumn(name = "ACCOUNTTYPECATALOGCODE", referencedColumnName = "CATALOGCODE")})
    @ManyToOne
    private Tgenecatalogdetail tgenecatalogdetail;
    @JoinColumns({
        @JoinColumn(name = "FIGURESCATALOG", referencedColumnName = "CATALOG"),
        @JoinColumn(name = "FIGURESCATALOGCODE", referencedColumnName = "CATALOGCODE")})
    @ManyToOne
    private Tgenecatalogdetail tgenecatalogdetail1;
    @JoinColumn(name = "CURRENCYCODE", referencedColumnName = "CURRENCYCODE")
    @ManyToOne
    private Tgenecurrency currencycode;
    @JoinColumn(name = "INGRESSUSERCODE", referencedColumnName = "USERCODE")
    @ManyToOne
    private Tsafeuser ingressusercode;
    @JoinColumn(name = "MODIFYUSERCODE", referencedColumnName = "USERCODE")
    @ManyToOne
    private Tsafeuser modifyusercode;

    public Tcustpersonbankreference() {
    }

    public Tcustpersonbankreference(TcustpersonbankreferencePK tcustpersonbankreferencePK) {
        this.tcustpersonbankreferencePK = tcustpersonbankreferencePK;
    }

    public Tcustpersonbankreference(long personcode, short referencesequence, Date dateto) {
        this.tcustpersonbankreferencePK = new TcustpersonbankreferencePK(personcode, referencesequence, dateto);
    }

    public TcustpersonbankreferencePK getTcustpersonbankreferencePK() {
        return tcustpersonbankreferencePK;
    }

    public void setTcustpersonbankreferencePK(TcustpersonbankreferencePK tcustpersonbankreferencePK) {
        this.tcustpersonbankreferencePK = tcustpersonbankreferencePK;
    }

    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 getAccountnumber() {
        return accountnumber;
    }

    public void setAccountnumber(String accountnumber) {
        this.accountnumber = accountnumber;
    }

    public Short getFiguresnumber() {
        return figuresnumber;
    }

    public void setFiguresnumber(Short figuresnumber) {
        this.figuresnumber = figuresnumber;
    }

    public Date getOpeningdate() {
        return openingdate;
    }

    public void setOpeningdate(Date openingdate) {
        this.openingdate = openingdate;
    }

    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 getBankpersoncode() {
        return bankpersoncode;
    }

    public void setBankpersoncode(Tcustperson bankpersoncode) {
        this.bankpersoncode = bankpersoncode;
    }

    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 Tgenecurrency getCurrencycode() {
        return currencycode;
    }

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

    public Tsafeuser getIngressusercode() {
        return ingressusercode;
    }

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

    public Tsafeuser getModifyusercode() {
        return modifyusercode;
    }

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

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

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