/*
 * 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.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
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.TGENEPROVINCE")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tgeneprovince.findAll", query = "SELECT t FROM Tgeneprovince t"),
    @NamedQuery(name = "Tgeneprovince.findByCountrycode", query = "SELECT t FROM Tgeneprovince t WHERE t.tgeneprovincePK.countrycode = :countrycode"),
    @NamedQuery(name = "Tgeneprovince.findByProvincecode", query = "SELECT t FROM Tgeneprovince t WHERE t.tgeneprovincePK.provincecode = :provincecode"),
    @NamedQuery(name = "Tgeneprovince.findByRecordversion", query = "SELECT t FROM Tgeneprovince t WHERE t.recordversion = :recordversion"),
    @NamedQuery(name = "Tgeneprovince.findByDescription", query = "SELECT t FROM Tgeneprovince t WHERE t.description = :description")})
public class Tgeneprovince implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TgeneprovincePK tgeneprovincePK;
    @Column(name = "RECORDVERSION")
    private BigInteger recordversion;
    @Basic(optional = false)
    @Column(name = "DESCRIPTION")
    private String description;
    @JoinColumn(name = "COUNTRYCODE", referencedColumnName = "COUNTRYCODE", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Tgenecountry tgenecountry;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tgeneprovince")
    private Collection<Tgenecanton> tgenecantonCollection;
    @OneToMany(mappedBy = "tgeneprovince")
    private Collection<Tarmcencontroljur> tarmcencontroljurCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tgeneprovince")
    private Collection<Tgeneprovincedesc> tgeneprovincedescCollection;

    public Tgeneprovince() {
    }

    public Tgeneprovince(TgeneprovincePK tgeneprovincePK) {
        this.tgeneprovincePK = tgeneprovincePK;
    }

    public Tgeneprovince(TgeneprovincePK tgeneprovincePK, String description) {
        this.tgeneprovincePK = tgeneprovincePK;
        this.description = description;
    }

    public Tgeneprovince(String countrycode, String provincecode) {
        this.tgeneprovincePK = new TgeneprovincePK(countrycode, provincecode);
    }

    public TgeneprovincePK getTgeneprovincePK() {
        return tgeneprovincePK;
    }

    public void setTgeneprovincePK(TgeneprovincePK tgeneprovincePK) {
        this.tgeneprovincePK = tgeneprovincePK;
    }

    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 Tgenecountry getTgenecountry() {
        return tgenecountry;
    }

    public void setTgenecountry(Tgenecountry tgenecountry) {
        this.tgenecountry = tgenecountry;
    }

    @XmlTransient
    public Collection<Tgenecanton> getTgenecantonCollection() {
        return tgenecantonCollection;
    }

    public void setTgenecantonCollection(Collection<Tgenecanton> tgenecantonCollection) {
        this.tgenecantonCollection = tgenecantonCollection;
    }

    @XmlTransient
    public Collection<Tarmcencontroljur> getTarmcencontroljurCollection() {
        return tarmcencontroljurCollection;
    }

    public void setTarmcencontroljurCollection(Collection<Tarmcencontroljur> tarmcencontroljurCollection) {
        this.tarmcencontroljurCollection = tarmcencontroljurCollection;
    }

    @XmlTransient
    public Collection<Tgeneprovincedesc> getTgeneprovincedescCollection() {
        return tgeneprovincedescCollection;
    }

    public void setTgeneprovincedescCollection(Collection<Tgeneprovincedesc> tgeneprovincedescCollection) {
        this.tgeneprovincedescCollection = tgeneprovincedescCollection;
    }

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

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