/*
 * 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.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.TCUSTCOMPANYBRANCH")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tcustcompanybranch.findAll", query = "SELECT t FROM Tcustcompanybranch t"),
    @NamedQuery(name = "Tcustcompanybranch.findByPersoncode", query = "SELECT t FROM Tcustcompanybranch t WHERE t.tcustcompanybranchPK.personcode = :personcode"),
    @NamedQuery(name = "Tcustcompanybranch.findByDateto", query = "SELECT t FROM Tcustcompanybranch t WHERE t.tcustcompanybranchPK.dateto = :dateto"),
    @NamedQuery(name = "Tcustcompanybranch.findByBranchsequence", query = "SELECT t FROM Tcustcompanybranch t WHERE t.tcustcompanybranchPK.branchsequence = :branchsequence"),
    @NamedQuery(name = "Tcustcompanybranch.findByDatefrom", query = "SELECT t FROM Tcustcompanybranch t WHERE t.datefrom = :datefrom"),
    @NamedQuery(name = "Tcustcompanybranch.findByRecordversion", query = "SELECT t FROM Tcustcompanybranch t WHERE t.recordversion = :recordversion"),
    @NamedQuery(name = "Tcustcompanybranch.findByName", query = "SELECT t FROM Tcustcompanybranch t WHERE t.name = :name"),
    @NamedQuery(name = "Tcustcompanybranch.findByAddressnumber", query = "SELECT t FROM Tcustcompanybranch t WHERE t.addressnumber = :addressnumber"),
    @NamedQuery(name = "Tcustcompanybranch.findByIngressuser", query = "SELECT t FROM Tcustcompanybranch t WHERE t.ingressuser = :ingressuser"),
    @NamedQuery(name = "Tcustcompanybranch.findByModifyuser", query = "SELECT t FROM Tcustcompanybranch t WHERE t.modifyuser = :modifyuser")})
public class Tcustcompanybranch implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TcustcompanybranchPK tcustcompanybranchPK;
    @Basic(optional = false)
    @Column(name = "DATEFROM")
    @Temporal(TemporalType.TIMESTAMP)
    private Date datefrom;
    @Column(name = "RECORDVERSION")
    private BigInteger recordversion;
    @Column(name = "NAME")
    private String name;
    @Column(name = "ADDRESSNUMBER")
    private Short addressnumber;
    @Column(name = "INGRESSUSER")
    private String ingressuser;
    @Column(name = "MODIFYUSER")
    private String modifyuser;
    @JoinColumn(name = "PERSONCODE", referencedColumnName = "PERSONCODE", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Tcustperson tcustperson;

    public Tcustcompanybranch() {
    }

    public Tcustcompanybranch(TcustcompanybranchPK tcustcompanybranchPK) {
        this.tcustcompanybranchPK = tcustcompanybranchPK;
    }

    public Tcustcompanybranch(TcustcompanybranchPK tcustcompanybranchPK, Date datefrom) {
        this.tcustcompanybranchPK = tcustcompanybranchPK;
        this.datefrom = datefrom;
    }

    public Tcustcompanybranch(long personcode, Date dateto, short branchsequence) {
        this.tcustcompanybranchPK = new TcustcompanybranchPK(personcode, dateto, branchsequence);
    }

    public TcustcompanybranchPK getTcustcompanybranchPK() {
        return tcustcompanybranchPK;
    }

    public void setTcustcompanybranchPK(TcustcompanybranchPK tcustcompanybranchPK) {
        this.tcustcompanybranchPK = tcustcompanybranchPK;
    }

    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 Short getAddressnumber() {
        return addressnumber;
    }

    public void setAddressnumber(Short addressnumber) {
        this.addressnumber = addressnumber;
    }

    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 Tcustperson getTcustperson() {
        return tcustperson;
    }

    public void setTcustperson(Tcustperson tcustperson) {
        this.tcustperson = tcustperson;
    }

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

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