how to use Apache Commons HashCodeBuilder, and EqualsBuilder (requires the following jar: commons-lang-2.6.jar) @Override public int hashCode(){ return new HashCodeBuilder() .append(getId()) .append(address) .append(contactDetails) .append(fName) .append(lName) .append(profile) .toHashCode(); } @Override public boolean equals(final Object obj) { if(obj instanceof Artist) { final Artist other = (Artist) obj; return new EqualsBuilder() .append(getId(), other.getId()) .append(address, other.address) .append(contactDetails, other.contactDetails) .append(fName, other.fName) .append(lName, other.lName) .append(profile, other.profile) .isEquals(); } else { return false; } }