@Override public boolean equals(Object obj) { if(obj == null) return false; if(obj == this) return true; if(obj.getClass() == this.getClass()) { //polymorphic getClass fixes problems with subclasses and symmetry AutoLookup alObj = (AutoLookupObject) obj; return this.getId().equals(alObj.getId()); } return false; } @Override public int hashCode() { return getId(); }