/*
 * 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.Basic;
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.TGENECITYDESC")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tgenecitydesc.findAll", query = "SELECT t FROM Tgenecitydesc t"),
    @NamedQuery(name = "Tgenecitydesc.findByCountrycode", query = "SELECT t FROM Tgenecitydesc t WHERE t.tgenecitydescPK.countrycode = :countrycode"),
    @NamedQuery(name = "Tgenecitydesc.findByProvincecode", query = "SELECT t FROM Tgenecitydesc t WHERE t.tgenecitydescPK.provincecode = :provincecode"),
    @NamedQuery(name = "Tgenecitydesc.findByCantoncode", query = "SELECT t FROM Tgenecitydesc t WHERE t.tgenecitydescPK.cantoncode = :cantoncode"),
    @NamedQuery(name = "Tgenecitydesc.findByCitycode", query = "SELECT t FROM Tgenecitydesc t WHERE t.tgenecitydescPK.citycode = :citycode"),
    @NamedQuery(name = "Tgenecitydesc.findByLanguage", query = "SELECT t FROM Tgenecitydesc t WHERE t.tgenecitydescPK.language = :language"),
    @NamedQuery(name = "Tgenecitydesc.findByRecordversion", query = "SELECT t FROM Tgenecitydesc t WHERE t.recordversion = :recordversion"),
    @NamedQuery(name = "Tgenecitydesc.findByDescription", query = "SELECT t FROM Tgenecitydesc t WHERE t.description = :description")})
public class Tgenecitydesc implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TgenecitydescPK tgenecitydescPK;
    @Column(name = "RECORDVERSION")
    private BigInteger recordversion;
    @Basic(optional = false)
    @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),
        @JoinColumn(name = "CITYCODE", referencedColumnName = "CITYCODE", insertable = false, updatable = false)})
    @ManyToOne(optional = false)
    private Tgenecity tgenecity;
    @JoinColumn(name = "LANGUAGE", referencedColumnName = "LANGUAGECODE", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Tgenelanguage tgenelanguage;

    public Tgenecitydesc() {
    }

    public Tgenecitydesc(TgenecitydescPK tgenecitydescPK) {
        this.tgenecitydescPK = tgenecitydescPK;
    }

    public Tgenecitydesc(TgenecitydescPK tgenecitydescPK, String description) {
        this.tgenecitydescPK = tgenecitydescPK;
        this.description = description;
    }

    public Tgenecitydesc(String countrycode, String provincecode, String cantoncode, String citycode, String language) {
        this.tgenecitydescPK = new TgenecitydescPK(countrycode, provincecode, cantoncode, citycode, language);
    }

    public TgenecitydescPK getTgenecitydescPK() {
        return tgenecitydescPK;
    }

    public void setTgenecitydescPK(TgenecitydescPK tgenecitydescPK) {
        this.tgenecitydescPK = tgenecitydescPK;
    }

    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 Tgenecity getTgenecity() {
        return tgenecity;
    }

    public void setTgenecity(Tgenecity tgenecity) {
        this.tgenecity = tgenecity;
    }

    public Tgenelanguage getTgenelanguage() {
        return tgenelanguage;
    }

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

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

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