el codigo de la clase Usuario es:
Código Java:
Ver original/*
* 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 co.com.glokal.almaviva.modelo.entity;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
/**
*
* @author jose.ceballos
*/
@Table(name = "usuario", uniqueConstraints = {
@UniqueConstraint(columnNames = {"usuario"})})
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "Usuario.findAll", query = "SELECT u FROM Usuario u"),
@NamedQuery(name = "Usuario.findByUsuario", query = "SELECT u FROM Usuario u WHERE u.usuario = :usuario"),
@NamedQuery(name = "Usuario.findByPassword", query = "SELECT u FROM Usuario u WHERE u.password = :password"),
@NamedQuery(name = "Usuario.findByNombre", query = "SELECT u FROM Usuario u WHERE u.nombre = :nombre"),
@NamedQuery(name = "Usuario.findById", query = "SELECT u FROM Usuario u WHERE u.id = :id")})
private static final long serialVersionUID = 1L;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 50)
@Column(name = "usuario", nullable = false, length = 50)
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 50)
@Column(name = "password", nullable = false, length = 50)
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 50)
@Column(name = "nombre", nullable = false, length = 50)
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id", nullable = false)
public Usuario() {
}
this.id = id;
}
this.id = id;
this.usuario = usuario;
this.password = password;
this.nombre = nombre;
}
return usuario;
}
public void setUsuario
(String usuario
) { this.usuario = usuario;
}
return password;
}
public void setPassword
(String password
) { this.password = password;
}
return nombre;
}
public void setNombre
(String nombre
) { this.nombre = nombre;
}
return id;
}
this.id = id;
}
@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 Usuario)) {
return false;
}
Usuario other = (Usuario) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
return "co.com.glokal.almaviva.controlador.entity.Usuario[ id=" + id + " ]";
}
}