@Override public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof EntityBase)) { return false; } EntityBase castOther = (EntityBase) other; return new EqualsBuilder() .append(this.getClass(), castOther.getClass()) .append(this.getId(), castOther.getId()) .isEquals(); }
@Override public int compareTo(EntityBase other) { return new CompareToBuilder().append(this.getId(), other.getId()).toComparison(); }