diff --git a/src/com/rjconsultores/ventaboletos/entidad/UsuarioEmpresa.java b/src/com/rjconsultores/ventaboletos/entidad/UsuarioEmpresa.java index a572e1127..beb9fa6cd 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/UsuarioEmpresa.java +++ b/src/com/rjconsultores/ventaboletos/entidad/UsuarioEmpresa.java @@ -120,27 +120,70 @@ public class UsuarioEmpresa implements Serializable { this.indValidaPreimpreso = indValidaPreimpreso; } - @Override - public int hashCode() { - int hash = 0; - hash += (usuarioEmpresaId != null ? usuarioEmpresaId.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 UsuarioEmpresa)) { - return false; - } - UsuarioEmpresa other = (UsuarioEmpresa) object; - if ((this.usuarioEmpresaId == null && other.usuarioEmpresaId != null) || (this.usuarioEmpresaId != null && !this.usuarioEmpresaId.equals(other.usuarioEmpresaId))) { - return false; - } - return true; - } + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((activo == null) ? 0 : activo.hashCode()); + result = prime * result + ((empresa == null) ? 0 : empresa.hashCode()); + result = prime * result + ((fecmodif == null) ? 0 : fecmodif.hashCode()); + result = prime * result + ((indValidaPreimpreso == null) ? 0 : indValidaPreimpreso.hashCode()); + result = prime * result + ((usuarioEmpresaId == null) ? 0 : usuarioEmpresaId.hashCode()); + result = prime * result + ((usuarioLog == null) ? 0 : usuarioLog.hashCode()); + result = prime * result + ((usuariomodifId == null) ? 0 : usuariomodifId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + UsuarioEmpresa other = (UsuarioEmpresa) obj; + if (activo == null) { + if (other.activo != null) + return false; + } else if (!activo.equals(other.activo)) + return false; + if (empresa == null) { + if (other.empresa != null) + return false; + } else if (!empresa.equals(other.empresa)) + return false; + if (fecmodif == null) { + if (other.fecmodif != null) + return false; + } else if (!fecmodif.equals(other.fecmodif)) + return false; + if (indValidaPreimpreso == null) { + if (other.indValidaPreimpreso != null) + return false; + } else if (!indValidaPreimpreso.equals(other.indValidaPreimpreso)) + return false; + if (usuarioEmpresaId == null) { + if (other.usuarioEmpresaId != null) + return false; + } else if (!usuarioEmpresaId.equals(other.usuarioEmpresaId)) + return false; + if (usuarioLog == null) { + if (other.usuarioLog != null) + return false; + } else if (!usuarioLog.equals(other.usuarioLog)) + return false; + if (usuariomodifId == null) { + if (other.usuariomodifId != null) + return false; + } else if (!usuariomodifId.equals(other.usuariomodifId)) + return false; + return true; + } + + @Override public String toString() { return "com.rjconsultores.ventaboletos.entidad.UsuarioEmpresa[usuarioEmpresaId=" + usuarioEmpresaId + "]"; }