/*
 * 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.Collection;
import javax.persistence.CascadeType;
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.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author developer2
 */
@Entity
@Table(name="COMACO.TCUSTBALANCEACCOUNT")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tcustbalanceaccount.findAll", query = "SELECT t FROM Tcustbalanceaccount t"),
    @NamedQuery(name = "Tcustbalanceaccount.findByAccountcode", query = "SELECT t FROM Tcustbalanceaccount t WHERE t.tcustbalanceaccountPK.accountcode = :accountcode"),
    @NamedQuery(name = "Tcustbalanceaccount.findByBalancecatalog", query = "SELECT t FROM Tcustbalanceaccount t WHERE t.tcustbalanceaccountPK.balancecatalog = :balancecatalog"),
    @NamedQuery(name = "Tcustbalanceaccount.findByBalancecatalogcode", query = "SELECT t FROM Tcustbalanceaccount t WHERE t.tcustbalanceaccountPK.balancecatalogcode = :balancecatalogcode"),
    @NamedQuery(name = "Tcustbalanceaccount.findByDescription", query = "SELECT t FROM Tcustbalanceaccount t WHERE t.description = :description"),
    @NamedQuery(name = "Tcustbalanceaccount.findBySignaccount", query = "SELECT t FROM Tcustbalanceaccount t WHERE t.signaccount = :signaccount"),
    @NamedQuery(name = "Tcustbalanceaccount.findBySignvalue", query = "SELECT t FROM Tcustbalanceaccount t WHERE t.signvalue = :signvalue"),
    @NamedQuery(name = "Tcustbalanceaccount.findByRecordversion", query = "SELECT t FROM Tcustbalanceaccount t WHERE t.recordversion = :recordversion"),
    @NamedQuery(name = "Tcustbalanceaccount.findByParameterfile", query = "SELECT t FROM Tcustbalanceaccount t WHERE t.parameterfile = :parameterfile")})
public class Tcustbalanceaccount implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TcustbalanceaccountPK tcustbalanceaccountPK;
    @Column(name = "DESCRIPTION")
    private String description;
    @Column(name = "SIGNACCOUNT")
    private String signaccount;
    @Column(name = "SIGNVALUE")
    private String signvalue;
    @Column(name = "RECORDVERSION")
    private BigInteger recordversion;
    @Column(name = "PARAMETERFILE")
    private String parameterfile;
    @JoinColumn(name = "ACCOLEVELCODE", referencedColumnName = "ACCOLEVELCODE")
    @ManyToOne
    private Tcustbalanceaccolevel accolevelcode;
    @JoinColumns({
        @JoinColumn(name = "ACCOUNTCATALOG", referencedColumnName = "CATALOG"),
        @JoinColumn(name = "ACCOUNTCATALOGCODE", 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;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tcustbalanceaccount")
    private Collection<Tcustbalancefinancial> tcustbalancefinancialCollection;

    public Tcustbalanceaccount() {
    }

    public Tcustbalanceaccount(TcustbalanceaccountPK tcustbalanceaccountPK) {
        this.tcustbalanceaccountPK = tcustbalanceaccountPK;
    }

    public Tcustbalanceaccount(String accountcode, String balancecatalog, String balancecatalogcode) {
        this.tcustbalanceaccountPK = new TcustbalanceaccountPK(accountcode, balancecatalog, balancecatalogcode);
    }

    public TcustbalanceaccountPK getTcustbalanceaccountPK() {
        return tcustbalanceaccountPK;
    }

    public void setTcustbalanceaccountPK(TcustbalanceaccountPK tcustbalanceaccountPK) {
        this.tcustbalanceaccountPK = tcustbalanceaccountPK;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getSignaccount() {
        return signaccount;
    }

    public void setSignaccount(String signaccount) {
        this.signaccount = signaccount;
    }

    public String getSignvalue() {
        return signvalue;
    }

    public void setSignvalue(String signvalue) {
        this.signvalue = signvalue;
    }

    public BigInteger getRecordversion() {
        return recordversion;
    }

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

    public String getParameterfile() {
        return parameterfile;
    }

    public void setParameterfile(String parameterfile) {
        this.parameterfile = parameterfile;
    }

    public Tcustbalanceaccolevel getAccolevelcode() {
        return accolevelcode;
    }

    public void setAccolevelcode(Tcustbalanceaccolevel accolevelcode) {
        this.accolevelcode = accolevelcode;
    }

    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;
    }

    @XmlTransient
    public Collection<Tcustbalancefinancial> getTcustbalancefinancialCollection() {
        return tcustbalancefinancialCollection;
    }

    public void setTcustbalancefinancialCollection(Collection<Tcustbalancefinancial> tcustbalancefinancialCollection) {
        this.tcustbalancefinancialCollection = tcustbalancefinancialCollection;
    }

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

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