152 lines
4.2 KiB
152 lines
4.2 KiB
/*
|
|
* 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 xforce.modelo;
|
|
|
|
import java.io.Serializable;
|
|
import java.util.List;
|
|
import javax.persistence.Basic;
|
|
import javax.persistence.CascadeType;
|
|
import javax.persistence.Column;
|
|
import javax.persistence.Entity;
|
|
import javax.persistence.GeneratedValue;
|
|
import javax.persistence.GenerationType;
|
|
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.validation.constraints.NotNull;
|
|
import javax.validation.constraints.Size;
|
|
import javax.xml.bind.annotation.XmlRootElement;
|
|
import javax.xml.bind.annotation.XmlTransient;
|
|
|
|
/**
|
|
*
|
|
* @author Samuel Gamez
|
|
*/
|
|
@Entity
|
|
@Table(name = "estados", catalog = "inventarioalmacen", schema = "")
|
|
@XmlRootElement
|
|
@NamedQueries({
|
|
@NamedQuery(name = "Estados.findAll", query = "SELECT e FROM Estados e"),
|
|
@NamedQuery(name = "Estados.findById", query = "SELECT e FROM Estados e WHERE e.id = :id"),
|
|
@NamedQuery(name = "Estados.findByNombre", query = "SELECT e FROM Estados e WHERE e.nombre = :nombre"),
|
|
@NamedQuery(name = "Estados.findByEstado", query = "SELECT e FROM Estados e WHERE e.estado = :estado")})
|
|
public class Estados implements Serializable {
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
@Id
|
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
@Basic(optional = false)
|
|
@Column(name = "id")
|
|
private Integer id;
|
|
@Basic(optional = false)
|
|
@NotNull
|
|
@Size(min = 1, max = 45)
|
|
@Column(name = "nombre")
|
|
private String nombre;
|
|
@Basic(optional = false)
|
|
@NotNull
|
|
@Column(name = "estado")
|
|
private int estado;
|
|
@OneToMany(cascade = CascadeType.ALL, mappedBy = "estadosId")
|
|
private List<Proveedor> proveedorList;
|
|
@OneToMany(cascade = CascadeType.ALL, mappedBy = "estadosId")
|
|
private List<Usuarios> usuariosList;
|
|
@JoinColumn(name = "paises_id", referencedColumnName = "id")
|
|
@ManyToOne(optional = false)
|
|
private Paises paisesId;
|
|
|
|
public Estados() {
|
|
}
|
|
|
|
public Estados(Integer id) {
|
|
this.id = id;
|
|
}
|
|
|
|
public Estados(Integer id, String nombre, int estado) {
|
|
this.id = id;
|
|
this.nombre = nombre;
|
|
this.estado = estado;
|
|
}
|
|
|
|
public Integer getId() {
|
|
return id;
|
|
}
|
|
|
|
public void setId(Integer id) {
|
|
this.id = id;
|
|
}
|
|
|
|
public String getNombre() {
|
|
return nombre;
|
|
}
|
|
|
|
public void setNombre(String nombre) {
|
|
this.nombre = nombre;
|
|
}
|
|
|
|
public int getEstado() {
|
|
return estado;
|
|
}
|
|
|
|
public void setEstado(int estado) {
|
|
this.estado = estado;
|
|
}
|
|
|
|
@XmlTransient
|
|
public List<Proveedor> getProveedorList() {
|
|
return proveedorList;
|
|
}
|
|
|
|
public void setProveedorList(List<Proveedor> proveedorList) {
|
|
this.proveedorList = proveedorList;
|
|
}
|
|
|
|
@XmlTransient
|
|
public List<Usuarios> getUsuariosList() {
|
|
return usuariosList;
|
|
}
|
|
|
|
public void setUsuariosList(List<Usuarios> usuariosList) {
|
|
this.usuariosList = usuariosList;
|
|
}
|
|
|
|
public Paises getPaisesId() {
|
|
return paisesId;
|
|
}
|
|
|
|
public void setPaisesId(Paises paisesId) {
|
|
this.paisesId = paisesId;
|
|
}
|
|
|
|
@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 Estados)) {
|
|
return false;
|
|
}
|
|
Estados other = (Estados) 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 "xforce.modelo.Estados[ id=" + id + " ]";
|
|
}
|
|
|
|
}
|
|
|