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

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

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TgenecantonPK tgenecantonPK;
    @Column(name = "RECORDVERSION")
    private BigInteger recordversion;
    @Column(name = "DESCRIPTION")
    private String description;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tgenecanton")
    private Collection<Tgenecity> tgenecityCollection;
    @JoinColumns({
        @JoinColumn(name = "COUNTRYCODE", referencedColumnName = "COUNTRYCODE", insertable = false, updatable = false),
        @JoinColumn(name = "PROVINCECODE", referencedColumnName = "PROVINCECODE", insertable = false, updatable = false)})
    @ManyToOne(optional = false)
    private Tgeneprovince tgeneprovince;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tgenecanton")
    private Collection<Tgeneparroquia> tgeneparroquiaCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tgenecanton")
    private Collection<Tegenecantondesc> tegenecantondescCollection;
    @OneToMany(mappedBy = "tgenecanton")
    private Collection<Tarmsolicitud> tarmsolicitudCollection;
    @OneToMany(mappedBy = "tgenecanton1")
    private Collection<Tarmsolicitud> tarmsolicitudCollection1;

    public Tgenecanton() {
    }

    public Tgenecanton(TgenecantonPK tgenecantonPK) {
        this.tgenecantonPK = tgenecantonPK;
    }

    public Tgenecanton(String countrycode, String provincecode, String cantoncode) {
        this.tgenecantonPK = new TgenecantonPK(countrycode, provincecode, cantoncode);
    }

    public TgenecantonPK getTgenecantonPK() {
        return tgenecantonPK;
    }

    public void setTgenecantonPK(TgenecantonPK tgenecantonPK) {
        this.tgenecantonPK = tgenecantonPK;
    }

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

    @XmlTransient
    public Collection<Tgenecity> getTgenecityCollection() {
        return tgenecityCollection;
    }

    public void setTgenecityCollection(Collection<Tgenecity> tgenecityCollection) {
        this.tgenecityCollection = tgenecityCollection;
    }

    public Tgeneprovince getTgeneprovince() {
        return tgeneprovince;
    }

    public void setTgeneprovince(Tgeneprovince tgeneprovince) {
        this.tgeneprovince = tgeneprovince;
    }

    @XmlTransient
    public Collection<Tgeneparroquia> getTgeneparroquiaCollection() {
        return tgeneparroquiaCollection;
    }

    public void setTgeneparroquiaCollection(Collection<Tgeneparroquia> tgeneparroquiaCollection) {
        this.tgeneparroquiaCollection = tgeneparroquiaCollection;
    }

    @XmlTransient
    public Collection<Tegenecantondesc> getTegenecantondescCollection() {
        return tegenecantondescCollection;
    }

    public void setTegenecantondescCollection(Collection<Tegenecantondesc> tegenecantondescCollection) {
        this.tegenecantondescCollection = tegenecantondescCollection;
    }

    @XmlTransient
    public Collection<Tarmsolicitud> getTarmsolicitudCollection() {
        return tarmsolicitudCollection;
    }

    public void setTarmsolicitudCollection(Collection<Tarmsolicitud> tarmsolicitudCollection) {
        this.tarmsolicitudCollection = tarmsolicitudCollection;
    }

    @XmlTransient
    public Collection<Tarmsolicitud> getTarmsolicitudCollection1() {
        return tarmsolicitudCollection1;
    }

    public void setTarmsolicitudCollection1(Collection<Tarmsolicitud> tarmsolicitudCollection1) {
        this.tarmsolicitudCollection1 = tarmsolicitudCollection1;
    }

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

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