/*
 * 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.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.TGENEACCOUNTINGDATE")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tgeneaccountingdate.findAll", query = "SELECT t FROM Tgeneaccountingdate t"),
    @NamedQuery(name = "Tgeneaccountingdate.findByBranchcode", query = "SELECT t FROM Tgeneaccountingdate t WHERE t.tgeneaccountingdatePK.branchcode = :branchcode"),
    @NamedQuery(name = "Tgeneaccountingdate.findByCompanycode", query = "SELECT t FROM Tgeneaccountingdate t WHERE t.tgeneaccountingdatePK.companycode = :companycode"),
    @NamedQuery(name = "Tgeneaccountingdate.findByRealdate", query = "SELECT t FROM Tgeneaccountingdate t WHERE t.tgeneaccountingdatePK.realdate = :realdate"),
    @NamedQuery(name = "Tgeneaccountingdate.findByAccountingdate", query = "SELECT t FROM Tgeneaccountingdate t WHERE t.accountingdate = :accountingdate"),
    @NamedQuery(name = "Tgeneaccountingdate.findByWorkingdate", query = "SELECT t FROM Tgeneaccountingdate t WHERE t.workingdate = :workingdate")})
public class Tgeneaccountingdate implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TgeneaccountingdatePK tgeneaccountingdatePK;
    @Column(name = "ACCOUNTINGDATE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date accountingdate;
    @Column(name = "WORKINGDATE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date workingdate;
    @JoinColumns({
        @JoinColumn(name = "BRANCHCODE", referencedColumnName = "BRANCHCODE", insertable = false, updatable = false),
        @JoinColumn(name = "COMPANYCODE", referencedColumnName = "COMPANYCODE", insertable = false, updatable = false)})
    @ManyToOne(optional = false)
    private Tgenebranch tgenebranch;

    public Tgeneaccountingdate() {
    }

    public Tgeneaccountingdate(TgeneaccountingdatePK tgeneaccountingdatePK) {
        this.tgeneaccountingdatePK = tgeneaccountingdatePK;
    }

    public Tgeneaccountingdate(short branchcode, long companycode, Date realdate) {
        this.tgeneaccountingdatePK = new TgeneaccountingdatePK(branchcode, companycode, realdate);
    }

    public TgeneaccountingdatePK getTgeneaccountingdatePK() {
        return tgeneaccountingdatePK;
    }

    public void setTgeneaccountingdatePK(TgeneaccountingdatePK tgeneaccountingdatePK) {
        this.tgeneaccountingdatePK = tgeneaccountingdatePK;
    }

    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 Tgenebranch getTgenebranch() {
        return tgenebranch;
    }

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

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

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