/*
 * 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.Basic;
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.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author developer2
 */
@Entity
@Table(name="COMACO.TGENEACCOUNTINGDATEBRANCH")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tgeneaccountingdatebranch.findAll", query = "SELECT t FROM Tgeneaccountingdatebranch t"),
    @NamedQuery(name = "Tgeneaccountingdatebranch.findByBranchcode", query = "SELECT t FROM Tgeneaccountingdatebranch t WHERE t.tgeneaccountingdatebranchPK.branchcode = :branchcode"),
    @NamedQuery(name = "Tgeneaccountingdatebranch.findByCompanycode", query = "SELECT t FROM Tgeneaccountingdatebranch t WHERE t.tgeneaccountingdatebranchPK.companycode = :companycode"),
    @NamedQuery(name = "Tgeneaccountingdatebranch.findByRecordversion", query = "SELECT t FROM Tgeneaccountingdatebranch t WHERE t.recordversion = :recordversion"),
    @NamedQuery(name = "Tgeneaccountingdatebranch.findByRealdate", query = "SELECT t FROM Tgeneaccountingdatebranch t WHERE t.realdate = :realdate"),
    @NamedQuery(name = "Tgeneaccountingdatebranch.findByAccountingdate", query = "SELECT t FROM Tgeneaccountingdatebranch t WHERE t.accountingdate = :accountingdate"),
    @NamedQuery(name = "Tgeneaccountingdatebranch.findByWorkingdate", query = "SELECT t FROM Tgeneaccountingdatebranch t WHERE t.workingdate = :workingdate"),
    @NamedQuery(name = "Tgeneaccountingdatebranch.findByPreviousaccountingdate", query = "SELECT t FROM Tgeneaccountingdatebranch t WHERE t.previousaccountingdate = :previousaccountingdate"),
    @NamedQuery(name = "Tgeneaccountingdatebranch.findByNextaccountingdate", query = "SELECT t FROM Tgeneaccountingdatebranch t WHERE t.nextaccountingdate = :nextaccountingdate")})
public class Tgeneaccountingdatebranch implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TgeneaccountingdatebranchPK tgeneaccountingdatebranchPK;
    @Column(name = "RECORDVERSION")
    private BigInteger recordversion;
    @Column(name = "REALDATE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date realdate;
    @Basic(optional = false)
    @Column(name = "ACCOUNTINGDATE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date accountingdate;
    @Column(name = "WORKINGDATE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date workingdate;
    @Column(name = "PREVIOUSACCOUNTINGDATE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date previousaccountingdate;
    @Column(name = "NEXTACCOUNTINGDATE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date nextaccountingdate;
    @JoinColumns({
        @JoinColumn(name = "BRANCHCODE", referencedColumnName = "BRANCHCODE", insertable = false, updatable = false),
        @JoinColumn(name = "COMPANYCODE", referencedColumnName = "COMPANYCODE", insertable = false, updatable = false)})
    @OneToOne(optional = false)
    private Tgenebranch tgenebranch;
    @JoinColumn(name = "USERCODE", referencedColumnName = "USERCODE")
    @ManyToOne
    private Tsafeuser usercode;

    public Tgeneaccountingdatebranch() {
    }

    public Tgeneaccountingdatebranch(TgeneaccountingdatebranchPK tgeneaccountingdatebranchPK) {
        this.tgeneaccountingdatebranchPK = tgeneaccountingdatebranchPK;
    }

    public Tgeneaccountingdatebranch(TgeneaccountingdatebranchPK tgeneaccountingdatebranchPK, Date accountingdate) {
        this.tgeneaccountingdatebranchPK = tgeneaccountingdatebranchPK;
        this.accountingdate = accountingdate;
    }

    public Tgeneaccountingdatebranch(short branchcode, long companycode) {
        this.tgeneaccountingdatebranchPK = new TgeneaccountingdatebranchPK(branchcode, companycode);
    }

    public TgeneaccountingdatebranchPK getTgeneaccountingdatebranchPK() {
        return tgeneaccountingdatebranchPK;
    }

    public void setTgeneaccountingdatebranchPK(TgeneaccountingdatebranchPK tgeneaccountingdatebranchPK) {
        this.tgeneaccountingdatebranchPK = tgeneaccountingdatebranchPK;
    }

    public BigInteger getRecordversion() {
        return recordversion;
    }

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

    public Date getRealdate() {
        return realdate;
    }

    public void setRealdate(Date realdate) {
        this.realdate = realdate;
    }

    public Date getAccountingdate() {
        return accountingdate;
    }

    public void setAccountingdate(Date accountingdate) {
        this.accountingdate = accountingdate;
    }

    public Date getWorkingdate() {
        return workingdate;
    }

    public void setWorkingdate(Date workingdate) {
        this.workingdate = workingdate;
    }

    public Date getPreviousaccountingdate() {
        return previousaccountingdate;
    }

    public void setPreviousaccountingdate(Date previousaccountingdate) {
        this.previousaccountingdate = previousaccountingdate;
    }

    public Date getNextaccountingdate() {
        return nextaccountingdate;
    }

    public void setNextaccountingdate(Date nextaccountingdate) {
        this.nextaccountingdate = nextaccountingdate;
    }

    public Tgenebranch getTgenebranch() {
        return tgenebranch;
    }

    public void setTgenebranch(Tgenebranch tgenebranch) {
        this.tgenebranch = tgenebranch;
    }

    public Tsafeuser getUsercode() {
        return usercode;
    }

    public void setUsercode(Tsafeuser usercode) {
        this.usercode = usercode;
    }

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

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