/*
 * 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.TBPMFIELDTRANSACTIONORIGIN")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tbpmfieldtransactionorigin.findAll", query = "SELECT t FROM Tbpmfieldtransactionorigin t"),
    @NamedQuery(name = "Tbpmfieldtransactionorigin.findByTransactionmodule", query = "SELECT t FROM Tbpmfieldtransactionorigin t WHERE t.tbpmfieldtransactionoriginPK.transactionmodule = :transactionmodule"),
    @NamedQuery(name = "Tbpmfieldtransactionorigin.findByTransactioncode", query = "SELECT t FROM Tbpmfieldtransactionorigin t WHERE t.tbpmfieldtransactionoriginPK.transactioncode = :transactioncode"),
    @NamedQuery(name = "Tbpmfieldtransactionorigin.findByTransactionversion", query = "SELECT t FROM Tbpmfieldtransactionorigin t WHERE t.tbpmfieldtransactionoriginPK.transactionversion = :transactionversion"),
    @NamedQuery(name = "Tbpmfieldtransactionorigin.findByFieldname", query = "SELECT t FROM Tbpmfieldtransactionorigin t WHERE t.tbpmfieldtransactionoriginPK.fieldname = :fieldname"),
    @NamedQuery(name = "Tbpmfieldtransactionorigin.findByExpresionlanguage", query = "SELECT t FROM Tbpmfieldtransactionorigin t WHERE t.expresionlanguage = :expresionlanguage")})
public class Tbpmfieldtransactionorigin implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TbpmfieldtransactionoriginPK tbpmfieldtransactionoriginPK;
    @Column(name = "EXPRESIONLANGUAGE")
    private String expresionlanguage;
    @JoinColumn(name = "FIELDNAME", referencedColumnName = "FIELDNAME", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Tbpmfield tbpmfield;
    @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 Tbpmfieldtransactionorigin() {
    }

    public Tbpmfieldtransactionorigin(TbpmfieldtransactionoriginPK tbpmfieldtransactionoriginPK) {
        this.tbpmfieldtransactionoriginPK = tbpmfieldtransactionoriginPK;
    }

    public Tbpmfieldtransactionorigin(String transactionmodule, short transactioncode, short transactionversion, String fieldname) {
        this.tbpmfieldtransactionoriginPK = new TbpmfieldtransactionoriginPK(transactionmodule, transactioncode, transactionversion, fieldname);
    }

    public TbpmfieldtransactionoriginPK getTbpmfieldtransactionoriginPK() {
        return tbpmfieldtransactionoriginPK;
    }

    public void setTbpmfieldtransactionoriginPK(TbpmfieldtransactionoriginPK tbpmfieldtransactionoriginPK) {
        this.tbpmfieldtransactionoriginPK = tbpmfieldtransactionoriginPK;
    }

    public String getExpresionlanguage() {
        return expresionlanguage;
    }

    public void setExpresionlanguage(String expresionlanguage) {
        this.expresionlanguage = expresionlanguage;
    }

    public Tbpmfield getTbpmfield() {
        return tbpmfield;
    }

    public void setTbpmfield(Tbpmfield tbpmfield) {
        this.tbpmfield = tbpmfield;
    }

    public Tgenetransaction getTgenetransaction() {
        return tgenetransaction;
    }

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

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

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