/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.cosmodas.EntCosmos;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 * @author obper
 */
@Entity
@Table(name = "vBancos")
@XmlRootElement
@NamedQueries({
        @NamedQuery(name = "Bancos.findAll", query = "SELECT b FROM Bancos b ORDER BY b.codigoBanco"),
        @NamedQuery(name = "Bancos.findByCodigoBanco", query = "SELECT b FROM Bancos b WHERE b.codigoBanco = :codigoBanco"),
        @NamedQuery(name = "Bancos.findByNombreBanco", query = "SELECT b FROM Bancos b WHERE b.nombreBanco = :nombreBanco")})
public class Bancos implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 2)
    @Column(name = "codigo_banco")
    private String codigoBanco;
    @Size(max = 45)
    @Column(name = "nombre_banco")
    private String nombreBanco;

    public Bancos() {
    }

    public Bancos(String codigoBanco) {
        this.codigoBanco = codigoBanco;
    }

    public String getCodigoBanco() {
        return codigoBanco;
    }

    public void setCodigoBanco(String codigoBanco) {
        this.codigoBanco = codigoBanco;
    }

    public String getNombreBanco() {
        return nombreBanco;
    }

    public void setNombreBanco(String nombreBanco) {
        this.nombreBanco = nombreBanco;
    }

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

    @Override
    public String toString() {
        return "com.cosmodas.dbcon.Bancos[ codigoBanco=" + codigoBanco + " ]";
    }

}
