Administrador de la clase de jakarta, un sistema de inventario
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

142 lines
3.9 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 hola.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.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
/**
*
* @author chore
*/
@Entity
@Table(name = "estado", catalog = "sistemadeinventario", schema = "")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "Estado.findAll", query = "SELECT e FROM Estado e"),
@NamedQuery(name = "Estado.findById", query = "SELECT e FROM Estado e WHERE e.id = :id"),
@NamedQuery(name = "Estado.findByNombre", query = "SELECT e FROM Estado e WHERE e.nombre = :nombre"),
@NamedQuery(name = "Estado.findByStatus", query = "SELECT e FROM Estado e WHERE e.status = :status")})
public class Estado implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Size(max = 45)
@Column(name = "nombre")
private String nombre;
@Column(name = "status")
private Integer status;
@JoinColumn(name = "pais_idpais", referencedColumnName = "id")
@ManyToOne(optional = false)
private Pais paisIdpais;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "estadoIdestado")
private List<Provedor> provedorList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "estadoIdestado")
private List<Usuario> usuarioList;
public Estado() {
}
public Estado(Integer id) {
this.id = id;
}
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 Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Pais getPaisIdpais() {
return paisIdpais;
}
public void setPaisIdpais(Pais paisIdpais) {
this.paisIdpais = paisIdpais;
}
@XmlTransient
public List<Provedor> getProvedorList() {
return provedorList;
}
public void setProvedorList(List<Provedor> provedorList) {
this.provedorList = provedorList;
}
@XmlTransient
public List<Usuario> getUsuarioList() {
return usuarioList;
}
public void setUsuarioList(List<Usuario> usuarioList) {
this.usuarioList = usuarioList;
}
@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 Estado)) {
return false;
}
Estado other = (Estado) 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 "hola.modelo.Estado[ id=" + id + " ]";
}
}