/*
 * 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.BigDecimal;
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.TGENETECHNICALPATRIMONY")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tgenetechnicalpatrimony.findAll", query = "SELECT t FROM Tgenetechnicalpatrimony t"),
    @NamedQuery(name = "Tgenetechnicalpatrimony.findByCompanycode", query = "SELECT t FROM Tgenetechnicalpatrimony t WHERE t.tgenetechnicalpatrimonyPK.companycode = :companycode"),
    @NamedQuery(name = "Tgenetechnicalpatrimony.findByAmount", query = "SELECT t FROM Tgenetechnicalpatrimony t WHERE t.amount = :amount"),
    @NamedQuery(name = "Tgenetechnicalpatrimony.findByDateto", query = "SELECT t FROM Tgenetechnicalpatrimony t WHERE t.tgenetechnicalpatrimonyPK.dateto = :dateto"),
    @NamedQuery(name = "Tgenetechnicalpatrimony.findByDatefrom", query = "SELECT t FROM Tgenetechnicalpatrimony t WHERE t.datefrom = :datefrom"),
    @NamedQuery(name = "Tgenetechnicalpatrimony.findByPatrimonydate", query = "SELECT t FROM Tgenetechnicalpatrimony t WHERE t.patrimonydate = :patrimonydate")})
public class Tgenetechnicalpatrimony implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TgenetechnicalpatrimonyPK tgenetechnicalpatrimonyPK;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "AMOUNT")
    private BigDecimal amount;
    @Basic(optional = false)
    @Column(name = "DATEFROM")
    @Temporal(TemporalType.TIMESTAMP)
    private Date datefrom;
    @Column(name = "PATRIMONYDATE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date patrimonydate;
    @JoinColumn(name = "PERSONCODE", referencedColumnName = "PERSONCODE")
    @ManyToOne
    private Tcustperson personcode;
    @JoinColumn(name = "COMPANYCODE", referencedColumnName = "COMPANYCODE", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Tgenecompany tgenecompany;

    public Tgenetechnicalpatrimony() {
    }

    public Tgenetechnicalpatrimony(TgenetechnicalpatrimonyPK tgenetechnicalpatrimonyPK) {
        this.tgenetechnicalpatrimonyPK = tgenetechnicalpatrimonyPK;
    }

    public Tgenetechnicalpatrimony(TgenetechnicalpatrimonyPK tgenetechnicalpatrimonyPK, Date datefrom) {
        this.tgenetechnicalpatrimonyPK = tgenetechnicalpatrimonyPK;
        this.datefrom = datefrom;
    }

    public Tgenetechnicalpatrimony(long companycode, Date dateto) {
        this.tgenetechnicalpatrimonyPK = new TgenetechnicalpatrimonyPK(companycode, dateto);
    }

    public TgenetechnicalpatrimonyPK getTgenetechnicalpatrimonyPK() {
        return tgenetechnicalpatrimonyPK;
    }

    public void setTgenetechnicalpatrimonyPK(TgenetechnicalpatrimonyPK tgenetechnicalpatrimonyPK) {
        this.tgenetechnicalpatrimonyPK = tgenetechnicalpatrimonyPK;
    }

    public BigDecimal getAmount() {
        return amount;
    }

    public void setAmount(BigDecimal amount) {
        this.amount = amount;
    }

    public Date getDatefrom() {
        return datefrom;
    }

    public void setDatefrom(Date datefrom) {
        this.datefrom = datefrom;
    }

    public Date getPatrimonydate() {
        return patrimonydate;
    }

    public void setPatrimonydate(Date patrimonydate) {
        this.patrimonydate = patrimonydate;
    }

    public Tcustperson getPersoncode() {
        return personcode;
    }

    public void setPersoncode(Tcustperson personcode) {
        this.personcode = personcode;
    }

    public Tgenecompany getTgenecompany() {
        return tgenecompany;
    }

    public void setTgenecompany(Tgenecompany tgenecompany) {
        this.tgenecompany = tgenecompany;
    }

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

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