/*
 * 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.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.TGENECONCEPT")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tgeneconcept.findAll", query = "SELECT t FROM Tgeneconcept t"),
    @NamedQuery(name = "Tgeneconcept.findByConceptmodule", query = "SELECT t FROM Tgeneconcept t WHERE t.tgeneconceptPK.conceptmodule = :conceptmodule"),
    @NamedQuery(name = "Tgeneconcept.findByConceptcode", query = "SELECT t FROM Tgeneconcept t WHERE t.tgeneconceptPK.conceptcode = :conceptcode"),
    @NamedQuery(name = "Tgeneconcept.findByRecordversion", query = "SELECT t FROM Tgeneconcept t WHERE t.recordversion = :recordversion"),
    @NamedQuery(name = "Tgeneconcept.findByDebito", query = "SELECT t FROM Tgeneconcept t WHERE t.debito = :debito"),
    @NamedQuery(name = "Tgeneconcept.findByDescription", query = "SELECT t FROM Tgeneconcept t WHERE t.description = :description")})
public class Tgeneconcept implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TgeneconceptPK tgeneconceptPK;
    @Column(name = "RECORDVERSION")
    private BigInteger recordversion;
    @Column(name = "DEBITO")
    private String debito;
    @Column(name = "DESCRIPTION")
    private String description;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tgeneconcept")
    private Collection<Tgeneconceptdesc> tgeneconceptdescCollection;
    @JoinColumn(name = "CONCEPTMODULE", referencedColumnName = "MODULECODE", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Tgenemodule tgenemodule;

    public Tgeneconcept() {
    }

    public Tgeneconcept(TgeneconceptPK tgeneconceptPK) {
        this.tgeneconceptPK = tgeneconceptPK;
    }

    public Tgeneconcept(String conceptmodule, short conceptcode) {
        this.tgeneconceptPK = new TgeneconceptPK(conceptmodule, conceptcode);
    }

    public TgeneconceptPK getTgeneconceptPK() {
        return tgeneconceptPK;
    }

    public void setTgeneconceptPK(TgeneconceptPK tgeneconceptPK) {
        this.tgeneconceptPK = tgeneconceptPK;
    }

    public BigInteger getRecordversion() {
        return recordversion;
    }

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

    public String getDebito() {
        return debito;
    }

    public void setDebito(String debito) {
        this.debito = debito;
    }

    public String getDescription() {
        return description;
    }

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

    @XmlTransient
    public Collection<Tgeneconceptdesc> getTgeneconceptdescCollection() {
        return tgeneconceptdescCollection;
    }

    public void setTgeneconceptdescCollection(Collection<Tgeneconceptdesc> tgeneconceptdescCollection) {
        this.tgeneconceptdescCollection = tgeneconceptdescCollection;
    }

    public Tgenemodule getTgenemodule() {
        return tgenemodule;
    }

    public void setTgenemodule(Tgenemodule tgenemodule) {
        this.tgenemodule = tgenemodule;
    }

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

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