/*
 * 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.Entity;
import javax.persistence.Id;
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.TGENEMESSAGE")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tgenemessage.findAll", query = "SELECT t FROM Tgenemessage t"),
    @NamedQuery(name = "Tgenemessage.findByMessagecode", query = "SELECT t FROM Tgenemessage t WHERE t.messagecode = :messagecode"),
    @NamedQuery(name = "Tgenemessage.findByRecordversion", query = "SELECT t FROM Tgenemessage t WHERE t.recordversion = :recordversion"),
    @NamedQuery(name = "Tgenemessage.findByDescription", query = "SELECT t FROM Tgenemessage t WHERE t.description = :description")})
public class Tgenemessage implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "MESSAGECODE")
    private String messagecode;
    @Column(name = "RECORDVERSION")
    private BigInteger recordversion;
    @Basic(optional = false)
    @Column(name = "DESCRIPTION")
    private String description;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tgenemessage")
    private Collection<Tgenemessagedesc> tgenemessagedescCollection;

    public Tgenemessage() {
    }

    public Tgenemessage(String messagecode) {
        this.messagecode = messagecode;
    }

    public Tgenemessage(String messagecode, String description) {
        this.messagecode = messagecode;
        this.description = description;
    }

    public String getMessagecode() {
        return messagecode;
    }

    public void setMessagecode(String messagecode) {
        this.messagecode = messagecode;
    }

    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<Tgenemessagedesc> getTgenemessagedescCollection() {
        return tgenemessagedescCollection;
    }

    public void setTgenemessagedescCollection(Collection<Tgenemessagedesc> tgenemessagedescCollection) {
        this.tgenemessagedescCollection = tgenemessagedescCollection;
    }

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

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