/*
 * 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 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.TBPMGROUPSUSERS")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tbpmgroupsusers.findAll", query = "SELECT t FROM Tbpmgroupsusers t"),
    @NamedQuery(name = "Tbpmgroupsusers.findByUsercode", query = "SELECT t FROM Tbpmgroupsusers t WHERE t.tbpmgroupsusersPK.usercode = :usercode"),
    @NamedQuery(name = "Tbpmgroupsusers.findByGroupcode", query = "SELECT t FROM Tbpmgroupsusers t WHERE t.tbpmgroupsusersPK.groupcode = :groupcode"),
    @NamedQuery(name = "Tbpmgroupsusers.findByCompanycode", query = "SELECT t FROM Tbpmgroupsusers t WHERE t.tbpmgroupsusersPK.companycode = :companycode"),
    @NamedQuery(name = "Tbpmgroupsusers.findByRecordversion", query = "SELECT t FROM Tbpmgroupsusers t WHERE t.recordversion = :recordversion")})
public class Tbpmgroupsusers implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TbpmgroupsusersPK tbpmgroupsusersPK;
    @Column(name = "RECORDVERSION")
    private BigInteger recordversion;
    @JoinColumns({
        @JoinColumn(name = "GROUPCODE", referencedColumnName = "GROUPCODE", insertable = false, updatable = false),
        @JoinColumn(name = "COMPANYCODE", referencedColumnName = "COMPANYCODE", insertable = false, updatable = false)})
    @ManyToOne(optional = false)
    private Tbpmgroups tbpmgroups;
    @JoinColumn(name = "USERCODE", referencedColumnName = "USERCODE", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Tsafeuser tsafeuser;

    public Tbpmgroupsusers() {
    }

    public Tbpmgroupsusers(TbpmgroupsusersPK tbpmgroupsusersPK) {
        this.tbpmgroupsusersPK = tbpmgroupsusersPK;
    }

    public Tbpmgroupsusers(String usercode, String groupcode, long companycode) {
        this.tbpmgroupsusersPK = new TbpmgroupsusersPK(usercode, groupcode, companycode);
    }

    public TbpmgroupsusersPK getTbpmgroupsusersPK() {
        return tbpmgroupsusersPK;
    }

    public void setTbpmgroupsusersPK(TbpmgroupsusersPK tbpmgroupsusersPK) {
        this.tbpmgroupsusersPK = tbpmgroupsusersPK;
    }

    public BigInteger getRecordversion() {
        return recordversion;
    }

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

    public Tbpmgroups getTbpmgroups() {
        return tbpmgroups;
    }

    public void setTbpmgroups(Tbpmgroups tbpmgroups) {
        this.tbpmgroups = tbpmgroups;
    }

    public Tsafeuser getTsafeuser() {
        return tsafeuser;
    }

    public void setTsafeuser(Tsafeuser tsafeuser) {
        this.tsafeuser = tsafeuser;
    }

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

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