/*
 * 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.Basic;
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.TGENEFIELDS")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tgenefields.findAll", query = "SELECT t FROM Tgenefields t"),
    @NamedQuery(name = "Tgenefields.findByTname", query = "SELECT t FROM Tgenefields t WHERE t.tgenefieldsPK.tname = :tname"),
    @NamedQuery(name = "Tgenefields.findByEntity", query = "SELECT t FROM Tgenefields t WHERE t.tgenefieldsPK.entity = :entity"),
    @NamedQuery(name = "Tgenefields.findByField", query = "SELECT t FROM Tgenefields t WHERE t.tgenefieldsPK.field = :field"),
    @NamedQuery(name = "Tgenefields.findByFromdb", query = "SELECT t FROM Tgenefields t WHERE t.fromdb = :fromdb"),
    @NamedQuery(name = "Tgenefields.findByType", query = "SELECT t FROM Tgenefields t WHERE t.type = :type"),
    @NamedQuery(name = "Tgenefields.findByCaninsert", query = "SELECT t FROM Tgenefields t WHERE t.caninsert = :caninsert"),
    @NamedQuery(name = "Tgenefields.findByCanupdate", query = "SELECT t FROM Tgenefields t WHERE t.canupdate = :canupdate"),
    @NamedQuery(name = "Tgenefields.findByFktname", query = "SELECT t FROM Tgenefields t WHERE t.fktname = :fktname"),
    @NamedQuery(name = "Tgenefields.findByFkentity", query = "SELECT t FROM Tgenefields t WHERE t.fkentity = :fkentity"),
    @NamedQuery(name = "Tgenefields.findByFkconstraint", query = "SELECT t FROM Tgenefields t WHERE t.fkconstraint = :fkconstraint")})
public class Tgenefields implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TgenefieldsPK tgenefieldsPK;
    @Column(name = "FROMDB")
    private String fromdb;
    @Column(name = "TYPE")
    private String type;
    @Basic(optional = false)
    @Column(name = "CANINSERT")
    private String caninsert;
    @Basic(optional = false)
    @Column(name = "CANUPDATE")
    private String canupdate;
    @Column(name = "FKTNAME")
    private String fktname;
    @Column(name = "FKENTITY")
    private String fkentity;
    @Column(name = "FKCONSTRAINT")
    private String fkconstraint;
    @JoinColumns({
        @JoinColumn(name = "TNAME", referencedColumnName = "TNAME", insertable = false, updatable = false),
        @JoinColumn(name = "ENTITY", referencedColumnName = "ENTITY", insertable = false, updatable = false)})
    @ManyToOne(optional = false)
    private Tgeneentity tgeneentity;

    public Tgenefields() {
    }

    public Tgenefields(TgenefieldsPK tgenefieldsPK) {
        this.tgenefieldsPK = tgenefieldsPK;
    }

    public Tgenefields(TgenefieldsPK tgenefieldsPK, String caninsert, String canupdate) {
        this.tgenefieldsPK = tgenefieldsPK;
        this.caninsert = caninsert;
        this.canupdate = canupdate;
    }

    public Tgenefields(String tname, String entity, String field) {
        this.tgenefieldsPK = new TgenefieldsPK(tname, entity, field);
    }

    public TgenefieldsPK getTgenefieldsPK() {
        return tgenefieldsPK;
    }

    public void setTgenefieldsPK(TgenefieldsPK tgenefieldsPK) {
        this.tgenefieldsPK = tgenefieldsPK;
    }

    public String getFromdb() {
        return fromdb;
    }

    public void setFromdb(String fromdb) {
        this.fromdb = fromdb;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getCaninsert() {
        return caninsert;
    }

    public void setCaninsert(String caninsert) {
        this.caninsert = caninsert;
    }

    public String getCanupdate() {
        return canupdate;
    }

    public void setCanupdate(String canupdate) {
        this.canupdate = canupdate;
    }

    public String getFktname() {
        return fktname;
    }

    public void setFktname(String fktname) {
        this.fktname = fktname;
    }

    public String getFkentity() {
        return fkentity;
    }

    public void setFkentity(String fkentity) {
        this.fkentity = fkentity;
    }

    public String getFkconstraint() {
        return fkconstraint;
    }

    public void setFkconstraint(String fkconstraint) {
        this.fkconstraint = fkconstraint;
    }

    public Tgeneentity getTgeneentity() {
        return tgeneentity;
    }

    public void setTgeneentity(Tgeneentity tgeneentity) {
        this.tgeneentity = tgeneentity;
    }

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

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