On Wed, 21 Jun 2006 11:58:07 -0400, Gentry, Michael (Contractor) <[EMAIL PROTECTED]> wrote:

Would it make sense to add:

public int getHashCode()
{
  return getObjectId().hashCode();
}

Any thoughts on this?  Or is there another way to get a unique value for
an object that doesn't expose the entity/keys?  If only Java let me get
the pointer (I miss &).

My only concern is expanding the code to work with DOs that aren't yet registered with a DC. In that case, the OID is null, so the above code breaks. In order to not break the equals() contract though (I'm assuming you want getHashCode() to work similarly to hashCode()), you just have to be careful how you deal with null values. In particular, two DOs created from different classes, both with null OIDs probably shouldn't have the same hash code.

--
Kevin

Reply via email to