@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 Propietario)) { return false; } Propietario other = (Propietario) object; if ((this.getId() == null && other.getId() != null) || (this.getId() != null && !this.id.equals(other.id))) { return false; } return true; }