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

/**
 *
 * @author developer2
 */
@Entity
@Table(name="COMACO.TEGENECANTONDESC")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tegenecantondesc.findAll", query = "SELECT t FROM Tegenecantondesc t"),
    @NamedQuery(name = "Tegenecantondesc.findByCountrycode", query = "SELECT t FROM Tegenecantondesc t WHERE t.tegenecantondescPK.countrycode = :countrycode"),
    @NamedQuery(name = "Tegenecantondesc.findByProvincecode", query = "SELECT t FROM Tegenecantondesc t WHERE t.tegenecantondescPK.provincecode = :provincecode"),
    @NamedQuery(name = "Tegenecantondesc.findByCantoncode", query = "SELECT t FROM Tegenecantondesc t WHERE t.tegenecantondescPK.cantoncode = :cantoncode"),
    @NamedQuery(name = "Tegenecantondesc.findByLanguagecode", query = "SELECT t FROM Tegenecantondesc t WHERE t.tegenecantondescPK.languagecode = :languagecode"),
    @NamedQuery(name = "Tegenecantondesc.findByRecordversion", query = "SELECT t FROM Tegenecantondesc t WHERE t.recordversion = :recordversion"),
    @NamedQuery(name = "Tegenecantondesc.findByDescription", query = "SELECT t FROM Tegenecantondesc t WHERE t.description = :description")})
public class Tegenecantondesc implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TegenecantondescPK tegenecantondescPK;
    @Column(name = "RECORDVERSION")
    private BigInteger recordversion;
    @Column(name = "DESCRIPTION")
    private String description;
    @JoinColumns({
        @JoinColumn(name = "COUNTRYCODE", referencedColumnName = "COUNTRYCODE", insertable = false, updatable = false),
        @JoinColumn(name = "PROVINCECODE", referencedColumnName = "PROVINCECODE", insertable = false, updatable = false),
        @JoinColumn(name = "CANTONCODE", referencedColumnName = "CANTONCODE", insertable = false, updatable = false)})
    @ManyToOne(optional = false)
    private Tgenecanton tgenecanton;
    @JoinColumn(name = "LANGUAGECODE", referencedColumnName = "LANGUAGECODE", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Tgenelanguage tgenelanguage;

    public Tegenecantondesc() {
    }

    public Tegenecantondesc(TegenecantondescPK tegenecantondescPK) {
        this.tegenecantondescPK = tegenecantondescPK;
    }

    public Tegenecantondesc(String countrycode, String provincecode, String cantoncode, String languagecode) {
        this.tegenecantondescPK = new TegenecantondescPK(countrycode, provincecode, cantoncode, languagecode);
    }

    public TegenecantondescPK getTegenecantondescPK() {
        return tegenecantondescPK;
    }

    public void setTegenecantondescPK(TegenecantondescPK tegenecantondescPK) {
        this.tegenecantondescPK = tegenecantondescPK;
    }

    public BigInteger getRecordversion() {
        return recordversion;
    }

    public void setRecordversion(BigInteger recordversion) {
        this.recordversion = recordversion;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Tgenecanton getTgenecanton() {
        return tgenecanton;
    }

    public void setTgenecanton(Tgenecanton tgenecanton) {
        this.tgenecanton = tgenecanton;
    }

    public Tgenelanguage getTgenelanguage() {
        return tgenelanguage;
    }

    public void setTgenelanguage(Tgenelanguage tgenelanguage) {
        this.tgenelanguage = tgenelanguage;
    }

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

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