/*
 * 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.Collection;
import javax.persistence.CascadeType;
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.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author developer2
 */
@Entity
@Table(name="COMACO.TGENEBASERATE")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tgenebaserate.findAll", query = "SELECT t FROM Tgenebaserate t"),
    @NamedQuery(name = "Tgenebaserate.findByBaseratecatalog", query = "SELECT t FROM Tgenebaserate t WHERE t.tgenebaseratePK.baseratecatalog = :baseratecatalog"),
    @NamedQuery(name = "Tgenebaserate.findByBaseratecatalogcode", query = "SELECT t FROM Tgenebaserate t WHERE t.tgenebaseratePK.baseratecatalogcode = :baseratecatalogcode"),
    @NamedQuery(name = "Tgenebaserate.findByCurrencycode", query = "SELECT t FROM Tgenebaserate t WHERE t.tgenebaseratePK.currencycode = :currencycode")})
public class Tgenebaserate implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TgenebaseratePK tgenebaseratePK;
    @JoinColumns({
        @JoinColumn(name = "BASERATECATALOG", referencedColumnName = "CATALOG", insertable = false, updatable = false),
        @JoinColumn(name = "BASERATECATALOGCODE", 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;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tgenebaserate")
    private Collection<Tgenebaseratedetail> tgenebaseratedetailCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tgenebaserate")
    private Collection<Tgeneratesgroup> tgeneratesgroupCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tgenebaserate")
    private Collection<Tgenesegmentrate> tgenesegmentrateCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tgenebaserate")
    private Collection<Tgenesubproductrate> tgenesubproductrateCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tgenebaserate1")
    private Collection<Tgenesubproductrate> tgenesubproductrateCollection1;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tgenebaserate2")
    private Collection<Tgenesubproductrate> tgenesubproductrateCollection2;

    public Tgenebaserate() {
    }

    public Tgenebaserate(TgenebaseratePK tgenebaseratePK) {
        this.tgenebaseratePK = tgenebaseratePK;
    }

    public Tgenebaserate(String baseratecatalog, String baseratecatalogcode, String currencycode) {
        this.tgenebaseratePK = new TgenebaseratePK(baseratecatalog, baseratecatalogcode, currencycode);
    }

    public TgenebaseratePK getTgenebaseratePK() {
        return tgenebaseratePK;
    }

    public void setTgenebaseratePK(TgenebaseratePK tgenebaseratePK) {
        this.tgenebaseratePK = tgenebaseratePK;
    }

    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;
    }

    @XmlTransient
    public Collection<Tgenebaseratedetail> getTgenebaseratedetailCollection() {
        return tgenebaseratedetailCollection;
    }

    public void setTgenebaseratedetailCollection(Collection<Tgenebaseratedetail> tgenebaseratedetailCollection) {
        this.tgenebaseratedetailCollection = tgenebaseratedetailCollection;
    }

    @XmlTransient
    public Collection<Tgeneratesgroup> getTgeneratesgroupCollection() {
        return tgeneratesgroupCollection;
    }

    public void setTgeneratesgroupCollection(Collection<Tgeneratesgroup> tgeneratesgroupCollection) {
        this.tgeneratesgroupCollection = tgeneratesgroupCollection;
    }

    @XmlTransient
    public Collection<Tgenesegmentrate> getTgenesegmentrateCollection() {
        return tgenesegmentrateCollection;
    }

    public void setTgenesegmentrateCollection(Collection<Tgenesegmentrate> tgenesegmentrateCollection) {
        this.tgenesegmentrateCollection = tgenesegmentrateCollection;
    }

    @XmlTransient
    public Collection<Tgenesubproductrate> getTgenesubproductrateCollection() {
        return tgenesubproductrateCollection;
    }

    public void setTgenesubproductrateCollection(Collection<Tgenesubproductrate> tgenesubproductrateCollection) {
        this.tgenesubproductrateCollection = tgenesubproductrateCollection;
    }

    @XmlTransient
    public Collection<Tgenesubproductrate> getTgenesubproductrateCollection1() {
        return tgenesubproductrateCollection1;
    }

    public void setTgenesubproductrateCollection1(Collection<Tgenesubproductrate> tgenesubproductrateCollection1) {
        this.tgenesubproductrateCollection1 = tgenesubproductrateCollection1;
    }

    @XmlTransient
    public Collection<Tgenesubproductrate> getTgenesubproductrateCollection2() {
        return tgenesubproductrateCollection2;
    }

    public void setTgenesubproductrateCollection2(Collection<Tgenesubproductrate> tgenesubproductrateCollection2) {
        this.tgenesubproductrateCollection2 = tgenesubproductrateCollection2;
    }

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

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