/*
 * 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.TGENEINSTALLMENTTYPE")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tgeneinstallmenttype.findAll", query = "SELECT t FROM Tgeneinstallmenttype t"),
    @NamedQuery(name = "Tgeneinstallmenttype.findByInstallmenttype", query = "SELECT t FROM Tgeneinstallmenttype t WHERE t.tgeneinstallmenttypePK.installmenttype = :installmenttype"),
    @NamedQuery(name = "Tgeneinstallmenttype.findByModulecode", query = "SELECT t FROM Tgeneinstallmenttype t WHERE t.tgeneinstallmenttypePK.modulecode = :modulecode"),
    @NamedQuery(name = "Tgeneinstallmenttype.findByRecordversion", query = "SELECT t FROM Tgeneinstallmenttype t WHERE t.recordversion = :recordversion"),
    @NamedQuery(name = "Tgeneinstallmenttype.findByDescription", query = "SELECT t FROM Tgeneinstallmenttype t WHERE t.description = :description"),
    @NamedQuery(name = "Tgeneinstallmenttype.findByCommand", query = "SELECT t FROM Tgeneinstallmenttype t WHERE t.command = :command")})
public class Tgeneinstallmenttype implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TgeneinstallmenttypePK tgeneinstallmenttypePK;
    @Column(name = "RECORDVERSION")
    private BigInteger recordversion;
    @Column(name = "DESCRIPTION")
    private String description;
    @Column(name = "COMMAND")
    private String command;
    @JoinColumn(name = "MODULECODE", referencedColumnName = "MODULECODE", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Tgenemodule tgenemodule;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tgeneinstallmenttype")
    private Collection<Tgeneinstallmenttypedesc> tgeneinstallmenttypedescCollection;

    public Tgeneinstallmenttype() {
    }

    public Tgeneinstallmenttype(TgeneinstallmenttypePK tgeneinstallmenttypePK) {
        this.tgeneinstallmenttypePK = tgeneinstallmenttypePK;
    }

    public Tgeneinstallmenttype(String installmenttype, String modulecode) {
        this.tgeneinstallmenttypePK = new TgeneinstallmenttypePK(installmenttype, modulecode);
    }

    public TgeneinstallmenttypePK getTgeneinstallmenttypePK() {
        return tgeneinstallmenttypePK;
    }

    public void setTgeneinstallmenttypePK(TgeneinstallmenttypePK tgeneinstallmenttypePK) {
        this.tgeneinstallmenttypePK = tgeneinstallmenttypePK;
    }

    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 String getCommand() {
        return command;
    }

    public void setCommand(String command) {
        this.command = command;
    }

    public Tgenemodule getTgenemodule() {
        return tgenemodule;
    }

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

    @XmlTransient
    public Collection<Tgeneinstallmenttypedesc> getTgeneinstallmenttypedescCollection() {
        return tgeneinstallmenttypedescCollection;
    }

    public void setTgeneinstallmenttypedescCollection(Collection<Tgeneinstallmenttypedesc> tgeneinstallmenttypedescCollection) {
        this.tgeneinstallmenttypedescCollection = tgeneinstallmenttypedescCollection;
    }

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

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