/*
 * 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 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.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author developer2
 */
@Entity
@Table(name="COMACO.TGENEDENOMINATION")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tgenedenomination.findAll", query = "SELECT t FROM Tgenedenomination t"),
    @NamedQuery(name = "Tgenedenomination.findByCurrencycode", query = "SELECT t FROM Tgenedenomination t WHERE t.tgenedenominationPK.currencycode = :currencycode"),
    @NamedQuery(name = "Tgenedenomination.findByCatalog", query = "SELECT t FROM Tgenedenomination t WHERE t.tgenedenominationPK.catalog = :catalog"),
    @NamedQuery(name = "Tgenedenomination.findByCatalogcode", query = "SELECT t FROM Tgenedenomination t WHERE t.tgenedenominationPK.catalogcode = :catalogcode"),
    @NamedQuery(name = "Tgenedenomination.findByValue", query = "SELECT t FROM Tgenedenomination t WHERE t.tgenedenominationPK.value = :value")})
public class Tgenedenomination implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TgenedenominationPK tgenedenominationPK;
    @JoinColumns({
        @JoinColumn(name = "CATALOG", referencedColumnName = "CATALOG", insertable = false, updatable = false),
        @JoinColumn(name = "CATALOGCODE", referencedColumnName = "CATALOGCODE", insertable = false, updatable = false)})
    @ManyToOne(optional = false)
    private Tgenecatalogdetail tgenecatalogdetail;
    @JoinColumn(name = "CURRENCYCODE", referencedColumnName = "CURRENCYCODE", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Tgenecurrency tgenecurrency;

    public Tgenedenomination() {
    }

    public Tgenedenomination(TgenedenominationPK tgenedenominationPK) {
        this.tgenedenominationPK = tgenedenominationPK;
    }

    public Tgenedenomination(String currencycode, String catalog, String catalogcode, BigDecimal value) {
        this.tgenedenominationPK = new TgenedenominationPK(currencycode, catalog, catalogcode, value);
    }

    public TgenedenominationPK getTgenedenominationPK() {
        return tgenedenominationPK;
    }

    public void setTgenedenominationPK(TgenedenominationPK tgenedenominationPK) {
        this.tgenedenominationPK = tgenedenominationPK;
    }

    public Tgenecatalogdetail getTgenecatalogdetail() {
        return tgenecatalogdetail;
    }

    public void setTgenecatalogdetail(Tgenecatalogdetail tgenecatalogdetail) {
        this.tgenecatalogdetail = tgenecatalogdetail;
    }

    public Tgenecurrency getTgenecurrency() {
        return tgenecurrency;
    }

    public void setTgenecurrency(Tgenecurrency tgenecurrency) {
        this.tgenecurrency = tgenecurrency;
    }

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

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