/*
 * 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.BigDecimal;
import java.math.BigInteger;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
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.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author developer2
 */
@Entity
@Table(name="COMACO.MD_COLUMNS")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "MdColumns.findAll", query = "SELECT m FROM MdColumns m"),
    @NamedQuery(name = "MdColumns.findById", query = "SELECT m FROM MdColumns m WHERE m.id = :id"),
    @NamedQuery(name = "MdColumns.findByColumnName", query = "SELECT m FROM MdColumns m WHERE m.columnName = :columnName"),
    @NamedQuery(name = "MdColumns.findByColumnOrder", query = "SELECT m FROM MdColumns m WHERE m.columnOrder = :columnOrder"),
    @NamedQuery(name = "MdColumns.findByColumnType", query = "SELECT m FROM MdColumns m WHERE m.columnType = :columnType"),
    @NamedQuery(name = "MdColumns.findByPrecision", query = "SELECT m FROM MdColumns m WHERE m.precision = :precision"),
    @NamedQuery(name = "MdColumns.findByScale", query = "SELECT m FROM MdColumns m WHERE m.scale = :scale"),
    @NamedQuery(name = "MdColumns.findByNullable", query = "SELECT m FROM MdColumns m WHERE m.nullable = :nullable"),
    @NamedQuery(name = "MdColumns.findByDefaultValue", query = "SELECT m FROM MdColumns m WHERE m.defaultValue = :defaultValue"),
    @NamedQuery(name = "MdColumns.findByNativeKey", query = "SELECT m FROM MdColumns m WHERE m.nativeKey = :nativeKey"),
    @NamedQuery(name = "MdColumns.findByDatatypeTransformedFlag", query = "SELECT m FROM MdColumns m WHERE m.datatypeTransformedFlag = :datatypeTransformedFlag"),
    @NamedQuery(name = "MdColumns.findByComments", query = "SELECT m FROM MdColumns m WHERE m.comments = :comments"),
    @NamedQuery(name = "MdColumns.findBySecurityGroupId", query = "SELECT m FROM MdColumns m WHERE m.securityGroupId = :securityGroupId"),
    @NamedQuery(name = "MdColumns.findByCreatedBy", query = "SELECT m FROM MdColumns m WHERE m.createdBy = :createdBy"),
    @NamedQuery(name = "MdColumns.findByCreatedOn", query = "SELECT m FROM MdColumns m WHERE m.createdOn = :createdOn"),
    @NamedQuery(name = "MdColumns.findByLastUpdatedBy", query = "SELECT m FROM MdColumns m WHERE m.lastUpdatedBy = :lastUpdatedBy"),
    @NamedQuery(name = "MdColumns.findByLastUpdatedOn", query = "SELECT m FROM MdColumns m WHERE m.lastUpdatedOn = :lastUpdatedOn")})
public class MdColumns implements Serializable {

    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @Basic(optional = false)
    @Column(name = "ID")
    private BigDecimal id;
    @Basic(optional = false)
    @Column(name = "COLUMN_NAME")
    private String columnName;
    @Basic(optional = false)
    @Column(name = "COLUMN_ORDER")
    private BigInteger columnOrder;
    @Column(name = "COLUMN_TYPE")
    private String columnType;
    @Column(name = "PRECISION")
    private BigInteger precision;
    @Column(name = "SCALE")
    private BigInteger scale;
    @Column(name = "NULLABLE")
    private Character nullable;
    @Column(name = "DEFAULT_VALUE")
    private String defaultValue;
    @Lob
    @Column(name = "NATIVE_SQL")
    private String nativeSql;
    @Column(name = "NATIVE_KEY")
    private String nativeKey;
    @Column(name = "DATATYPE_TRANSFORMED_FLAG")
    private Character datatypeTransformedFlag;
    @Column(name = "COMMENTS")
    private String comments;
    @Basic(optional = false)
    @Column(name = "SECURITY_GROUP_ID")
    private BigInteger securityGroupId;
    @Column(name = "CREATED_BY")
    private String createdBy;
    @Basic(optional = false)
    @Column(name = "CREATED_ON")
    @Temporal(TemporalType.TIMESTAMP)
    private Date createdOn;
    @Column(name = "LAST_UPDATED_BY")
    private String lastUpdatedBy;
    @Column(name = "LAST_UPDATED_ON")
    @Temporal(TemporalType.TIMESTAMP)
    private Date lastUpdatedOn;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "columnIdFk")
    private Collection<MdIndexDetails> mdIndexDetailsCollection;
    @OneToMany(mappedBy = "columnIdFk")
    private Collection<MdConstraintDetails> mdConstraintDetailsCollection;
    @JoinColumn(name = "TABLE_ID_FK", referencedColumnName = "ID")
    @ManyToOne(optional = false)
    private MdTables tableIdFk;

    public MdColumns() {
    }

    public MdColumns(BigDecimal id) {
        this.id = id;
    }

    public MdColumns(BigDecimal id, String columnName, BigInteger columnOrder, BigInteger securityGroupId, Date createdOn) {
        this.id = id;
        this.columnName = columnName;
        this.columnOrder = columnOrder;
        this.securityGroupId = securityGroupId;
        this.createdOn = createdOn;
    }

    public BigDecimal getId() {
        return id;
    }

    public void setId(BigDecimal id) {
        this.id = id;
    }

    public String getColumnName() {
        return columnName;
    }

    public void setColumnName(String columnName) {
        this.columnName = columnName;
    }

    public BigInteger getColumnOrder() {
        return columnOrder;
    }

    public void setColumnOrder(BigInteger columnOrder) {
        this.columnOrder = columnOrder;
    }

    public String getColumnType() {
        return columnType;
    }

    public void setColumnType(String columnType) {
        this.columnType = columnType;
    }

    public BigInteger getPrecision() {
        return precision;
    }

    public void setPrecision(BigInteger precision) {
        this.precision = precision;
    }

    public BigInteger getScale() {
        return scale;
    }

    public void setScale(BigInteger scale) {
        this.scale = scale;
    }

    public Character getNullable() {
        return nullable;
    }

    public void setNullable(Character nullable) {
        this.nullable = nullable;
    }

    public String getDefaultValue() {
        return defaultValue;
    }

    public void setDefaultValue(String defaultValue) {
        this.defaultValue = defaultValue;
    }

    public String getNativeSql() {
        return nativeSql;
    }

    public void setNativeSql(String nativeSql) {
        this.nativeSql = nativeSql;
    }

    public String getNativeKey() {
        return nativeKey;
    }

    public void setNativeKey(String nativeKey) {
        this.nativeKey = nativeKey;
    }

    public Character getDatatypeTransformedFlag() {
        return datatypeTransformedFlag;
    }

    public void setDatatypeTransformedFlag(Character datatypeTransformedFlag) {
        this.datatypeTransformedFlag = datatypeTransformedFlag;
    }

    public String getComments() {
        return comments;
    }

    public void setComments(String comments) {
        this.comments = comments;
    }

    public BigInteger getSecurityGroupId() {
        return securityGroupId;
    }

    public void setSecurityGroupId(BigInteger securityGroupId) {
        this.securityGroupId = securityGroupId;
    }

    public String getCreatedBy() {
        return createdBy;
    }

    public void setCreatedBy(String createdBy) {
        this.createdBy = createdBy;
    }

    public Date getCreatedOn() {
        return createdOn;
    }

    public void setCreatedOn(Date createdOn) {
        this.createdOn = createdOn;
    }

    public String getLastUpdatedBy() {
        return lastUpdatedBy;
    }

    public void setLastUpdatedBy(String lastUpdatedBy) {
        this.lastUpdatedBy = lastUpdatedBy;
    }

    public Date getLastUpdatedOn() {
        return lastUpdatedOn;
    }

    public void setLastUpdatedOn(Date lastUpdatedOn) {
        this.lastUpdatedOn = lastUpdatedOn;
    }

    @XmlTransient
    public Collection<MdIndexDetails> getMdIndexDetailsCollection() {
        return mdIndexDetailsCollection;
    }

    public void setMdIndexDetailsCollection(Collection<MdIndexDetails> mdIndexDetailsCollection) {
        this.mdIndexDetailsCollection = mdIndexDetailsCollection;
    }

    @XmlTransient
    public Collection<MdConstraintDetails> getMdConstraintDetailsCollection() {
        return mdConstraintDetailsCollection;
    }

    public void setMdConstraintDetailsCollection(Collection<MdConstraintDetails> mdConstraintDetailsCollection) {
        this.mdConstraintDetailsCollection = mdConstraintDetailsCollection;
    }

    public MdTables getTableIdFk() {
        return tableIdFk;
    }

    public void setTableIdFk(MdTables tableIdFk) {
        this.tableIdFk = tableIdFk;
    }

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

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