/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package ec.gob.mcds.seguridades.model; import java.io.Serializable; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; 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.Table; /** * * @author christian */ @Entity @Table(name = "sch_seguridades.usuario_rol") @NamedQueries({ @NamedQuery(name = "UsuarioRol.findAll", query = "SELECT u FROM UsuarioRol u")}) public class UsuarioRol implements Serializable { private static final long serialVersionUID = 1L; @Id @Basic(optional = false) @GeneratedValue(strategy=GenerationType.IDENTITY) @Column(name = "usu_rol_id", nullable = false) private Long usuRolId; @JoinColumn(name = "usu_id", referencedColumnName = "usu_id", nullable = false) @ManyToOne(optional = false, fetch = FetchType.LAZY) private Usuario usuario; @JoinColumn(name = "rol_id", referencedColumnName = "rol_id", nullable = false) @ManyToOne(optional = false, fetch = FetchType.LAZY) private Rol rol; public UsuarioRol() { } public UsuarioRol(Long usuRolId) { this.usuRolId = usuRolId; } public Long getUsuRolId() { return usuRolId; } public void setUsuRolId(Long usuRolId) { this.usuRolId = usuRolId; } public Usuario getUsuario() { return usuario; } public void setUsuario(Usuario usuario) { this.usuario = usuario; } public Rol getRol() { return rol; } public void setRol(Rol rol) { this.rol = rol; } @Override public int hashCode() { int hash = 0; hash += (usuRolId != null ? usuRolId.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 UsuarioRol)) { return false; } UsuarioRol other = (UsuarioRol) object; if ((this.usuRolId == null && other.usuRolId != null) || (this.usuRolId != null && !this.usuRolId.equals(other.usuRolId))) { return false; } return true; } @Override public String toString() { return "ec.gob.mcds.model.UsuarioRol[usuRolId=" + usuRolId + "]"; } }