/*
 * Created on 6 Aug 2015 ( Time 16:35:19 )
 * Generated by Telosys Tools Generator ( version 2.1.1 )
 */
// This Bean has a basic Primary Key (not composite)

package com.abm.mainet.common.domain;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import org.hibernate.annotations.GenericGenerator;

/**
 * Persistent class for entity stored in table "TB_COMPARENT_DET"
 *
 * @author Telosys Tools Generator
 *
 */

@Entity
@Table(name = "TB_COMPARENT_DET")
// Define named queries here
@NamedQueries({
        @NamedQuery(name = "TbComparentDetEntity.countAll", query = "SELECT COUNT(x) FROM TbComparentDetEntity x")
})
public class TbComparentDetEntity implements Serializable {

    private static final long serialVersionUID = 1L;

    // ----------------------------------------------------------------------
    // ENTITY PRIMARY KEY ( BASED ON A SINGLE FIELD )
    // ----------------------------------------------------------------------
    @Id
    @GenericGenerator(name = "MyCustomGenerator", strategy = "com.abm.mainet.common.utility.SequenceIdGenerator")
    @GeneratedValue(generator = "MyCustomGenerator")
    @Column(name = "COD_ID", nullable = false)
    private Long codId;

    // ----------------------------------------------------------------------
    // ENTITY DATA FIELDS
    // ----------------------------------------------------------------------
    @Column(name = "COD_DESC", nullable = false)
    private String codDesc;

    @Column(name = "COD_VALUE", nullable = false)
    private String codValue;

    @Column(name = "ORGID", nullable = false)
    private Long orgid;

    @Column(name = "USER_ID", nullable = false)
    private Long userId;

    @Column(name = "LANG_ID", nullable = false)
    private Long langId;

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "LMODDATE", nullable = false)
    private Date lmoddate;

    @Column(name = "UPDATED_BY")
    private Long updatedBy;

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "UPDATED_DATE")
    private Date updatedDate;

    @Column(name = "CPD_DEFAULT", length = 1)
    private String cpdDefault;

    @Column(name = "COD_STATUS")
    private String codStatus;

    @Column(name = "COD_DESC_MAR")
    private String codDescMar;

    @Column(name = "LG_IP_MAC", length = 100)
    private String lgIpMac;

    @Column(name = "LG_IP_MAC_UPD", length = 100)
    private String lgIpMacUpd;

    // ----------------------------------------------------------------------
    // ENTITY LINKS ( RELATIONSHIP )
    // ----------------------------------------------------------------------
    @ManyToOne
    @JoinColumn(name = "PARENT_ID", referencedColumnName = "COD_ID")
    private TbComparentDetEntity tbComparentDet;

    @ManyToOne
    @JoinColumn(name = "COM_ID", referencedColumnName = "COM_ID")
    private TbComparentMasEntity tbComparentMas;

    @OneToMany(mappedBy = "tbComparentDet", targetEntity = TbComparentDetEntity.class)
    private List<TbComparentDetEntity> listOfTbComparentDet;

    @Transient
    private long tempId;

    // ----------------------------------------------------------------------
    // CONSTRUCTOR(S)
    // ----------------------------------------------------------------------
    public TbComparentDetEntity() {
        super();
    }

    // ----------------------------------------------------------------------
    // GETTER & SETTER FOR THE KEY FIELD
    // ----------------------------------------------------------------------
    public void setCodId(final Long codId) {
        this.codId = codId;
    }

    public Long getCodId() {
        return codId;
    }

    // ----------------------------------------------------------------------
    // GETTERS & SETTERS FOR FIELDS
    // ----------------------------------------------------------------------
    // --- DATABASE MAPPING : COD_DESC ( NVARCHAR2 )
    public void setCodDesc(final String codDesc) {
        this.codDesc = codDesc;
    }

    public String getCodDesc() {
        return codDesc;
    }

    // --- DATABASE MAPPING : COD_VALUE ( NVARCHAR2 )
    public void setCodValue(final String codValue) {
        this.codValue = codValue;
    }

    public String getCodValue() {
        return codValue;
    }

    // --- DATABASE MAPPING : ORGID ( NUMBER )
    public void setOrgid(final Long orgid) {
        this.orgid = orgid;
    }

    public Long getOrgid() {
        return orgid;
    }

    // --- DATABASE MAPPING : USER_ID ( NUMBER )
    public void setUserId(final Long userId) {
        this.userId = userId;
    }

    public Long getUserId() {
        return userId;
    }

    // --- DATABASE MAPPING : LANG_ID ( NUMBER )
    public void setLangId(final Long langId) {
        this.langId = langId;
    }

    public Long getLangId() {
        return langId;
    }

    // --- DATABASE MAPPING : LMODDATE ( DATE )
    public void setLmoddate(final Date lmoddate) {
        this.lmoddate = lmoddate;
    }

    public Date getLmoddate() {
        return lmoddate;
    }

    // --- DATABASE MAPPING : UPDATED_BY ( NUMBER )
    public void setUpdatedBy(final Long updatedBy) {
        this.updatedBy = updatedBy;
    }

    public Long getUpdatedBy() {
        return updatedBy;
    }

    // --- DATABASE MAPPING : UPDATED_DATE ( DATE )
    public void setUpdatedDate(final Date updatedDate) {
        this.updatedDate = updatedDate;
    }

    public Date getUpdatedDate() {
        return updatedDate;
    }

    // --- DATABASE MAPPING : CPD_DEFAULT ( CHAR )
    public void setCpdDefault(final String cpdDefault) {
        this.cpdDefault = cpdDefault;
    }

    public String getCpdDefault() {
        return cpdDefault;
    }

    // --- DATABASE MAPPING : COD_STATUS ( NVARCHAR2 )
    public void setCodStatus(final String codStatus) {
        this.codStatus = codStatus;
    }

    public String getCodStatus() {
        return codStatus;
    }

    // --- DATABASE MAPPING : COD_DESC_MAR ( NVARCHAR2 )
    public void setCodDescMar(final String codDescMar) {
        this.codDescMar = codDescMar;
    }

    public String getCodDescMar() {
        return codDescMar;
    }

    // --- DATABASE MAPPING : LG_IP_MAC ( VARCHAR2 )
    public void setLgIpMac(final String lgIpMac) {
        this.lgIpMac = lgIpMac;
    }

    public String getLgIpMac() {
        return lgIpMac;
    }

    // --- DATABASE MAPPING : LG_IP_MAC_UPD ( VARCHAR2 )
    public void setLgIpMacUpd(final String lgIpMacUpd) {
        this.lgIpMacUpd = lgIpMacUpd;
    }

    public String getLgIpMacUpd() {
        return lgIpMacUpd;
    }

    // ----------------------------------------------------------------------
    // GETTERS & SETTERS FOR LINKS
    // ----------------------------------------------------------------------
    public void setTbComparentDet(final TbComparentDetEntity tbComparentDet) {
        this.tbComparentDet = tbComparentDet;
    }

    public TbComparentDetEntity getTbComparentDet() {
        return tbComparentDet;
    }

    public void setTbComparentMas(final TbComparentMasEntity tbComparentMas) {
        this.tbComparentMas = tbComparentMas;
    }

    public TbComparentMasEntity getTbComparentMas() {
        return tbComparentMas;
    }

    public void setListOfTbComparentDet(final List<TbComparentDetEntity> listOfTbComparentDet) {
        this.listOfTbComparentDet = listOfTbComparentDet;
    }

    public List<TbComparentDetEntity> getListOfTbComparentDet() {
        return listOfTbComparentDet;
    }

    public long getTempId() {
        return tempId;
    }

    public void setTempId(final long tempId) {
        this.tempId = tempId;
    }

    // ----------------------------------------------------------------------
    // toString METHOD
    // ----------------------------------------------------------------------
    @Override
    public String toString() {
        final StringBuffer sb = new StringBuffer();
        sb.append("[");
        sb.append(codId);
        sb.append("]:");
        sb.append(codDesc);
        sb.append("|");
        sb.append(codValue);
        sb.append("|");
        sb.append(orgid);
        sb.append("|");
        sb.append(userId);
        sb.append("|");
        sb.append(langId);
        sb.append("|");
        sb.append(lmoddate);
        sb.append("|");
        sb.append(updatedBy);
        sb.append("|");
        sb.append(updatedDate);
        sb.append("|");
        sb.append(cpdDefault);
        sb.append("|");
        sb.append(codStatus);
        sb.append("|");
        sb.append(codDescMar);
        sb.append("|");
        sb.append(lgIpMac);
        sb.append("|");
        sb.append(lgIpMacUpd);
        return sb.toString();
    }

    public String[] getPkValues() {
        return new String[] { "COM", "TB_COMPARENT_DET", "COD_ID" };
    }

}
