@Override
  public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + ((hostEntity == null) ? 0 : hostEntity.hashCode());
    result = prime * result + ((id == null) ? 0 : id.hashCode());
    result = prime * result + ((repositoryVersion == null) ? 0 : repositoryVersion.hashCode());
    result = prime * result + ((state == null) ? 0 : state.hashCode());
    return result;
  }
This constructor is mainly used by the unit tests in order to construct an object without the id.
ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostVersionEntity.java