/*
 * 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 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.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author developer2
 */
@Entity
@Table(name="COMACO.TGENEMENULEVELTRAN")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tgenemenuleveltran.findAll", query = "SELECT t FROM Tgenemenuleveltran t"),
    @NamedQuery(name = "Tgenemenuleveltran.findByMenucode", query = "SELECT t FROM Tgenemenuleveltran t WHERE t.tgenemenuleveltranPK.menucode = :menucode"),
    @NamedQuery(name = "Tgenemenuleveltran.findByLevelcode", query = "SELECT t FROM Tgenemenuleveltran t WHERE t.tgenemenuleveltranPK.levelcode = :levelcode"),
    @NamedQuery(name = "Tgenemenuleveltran.findByTransactionmodule", query = "SELECT t FROM Tgenemenuleveltran t WHERE t.tgenemenuleveltranPK.transactionmodule = :transactionmodule"),
    @NamedQuery(name = "Tgenemenuleveltran.findByTransactioncode", query = "SELECT t FROM Tgenemenuleveltran t WHERE t.tgenemenuleveltranPK.transactioncode = :transactioncode"),
    @NamedQuery(name = "Tgenemenuleveltran.findByTransactionversion", query = "SELECT t FROM Tgenemenuleveltran t WHERE t.tgenemenuleveltranPK.transactionversion = :transactionversion"),
    @NamedQuery(name = "Tgenemenuleveltran.findByPresentationorder", query = "SELECT t FROM Tgenemenuleveltran t WHERE t.presentationorder = :presentationorder")})
public class Tgenemenuleveltran implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TgenemenuleveltranPK tgenemenuleveltranPK;
    @Column(name = "PRESENTATIONORDER")
    private Short presentationorder;
    @JoinColumns({
        @JoinColumn(name = "MENUCODE", referencedColumnName = "MENUCODE", insertable = false, updatable = false),
        @JoinColumn(name = "LEVELCODE", referencedColumnName = "LEVELCODE", insertable = false, updatable = false)})
    @ManyToOne(optional = false)
    private Tgenemenulevel tgenemenulevel;
    @JoinColumns({
        @JoinColumn(name = "TRANSACTIONMODULE", referencedColumnName = "TRANSACTIONMODULE", insertable = false, updatable = false),
        @JoinColumn(name = "TRANSACTIONCODE", referencedColumnName = "TRANSACTIONCODE", insertable = false, updatable = false),
        @JoinColumn(name = "TRANSACTIONVERSION", referencedColumnName = "TRANSACTIONVERSION", insertable = false, updatable = false)})
    @ManyToOne(optional = false)
    private Tgenetransaction tgenetransaction;

    public Tgenemenuleveltran() {
    }

    public Tgenemenuleveltran(TgenemenuleveltranPK tgenemenuleveltranPK) {
        this.tgenemenuleveltranPK = tgenemenuleveltranPK;
    }

    public Tgenemenuleveltran(int menucode, int levelcode, String transactionmodule, short transactioncode, short transactionversion) {
        this.tgenemenuleveltranPK = new TgenemenuleveltranPK(menucode, levelcode, transactionmodule, transactioncode, transactionversion);
    }

    public TgenemenuleveltranPK getTgenemenuleveltranPK() {
        return tgenemenuleveltranPK;
    }

    public void setTgenemenuleveltranPK(TgenemenuleveltranPK tgenemenuleveltranPK) {
        this.tgenemenuleveltranPK = tgenemenuleveltranPK;
    }

    public Short getPresentationorder() {
        return presentationorder;
    }

    public void setPresentationorder(Short presentationorder) {
        this.presentationorder = presentationorder;
    }

    public Tgenemenulevel getTgenemenulevel() {
        return tgenemenulevel;
    }

    public void setTgenemenulevel(Tgenemenulevel tgenemenulevel) {
        this.tgenemenulevel = tgenemenulevel;
    }

    public Tgenetransaction getTgenetransaction() {
        return tgenetransaction;
    }

    public void setTgenetransaction(Tgenetransaction tgenetransaction) {
        this.tgenetransaction = tgenetransaction;
    }

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

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