Add getHashCode() to CayenneDataObject?

From: Gentry, Michael \(Contractor\) ("Gentry,)
Date: Wed Jun 21 2006 - 11:58:07 EDT

  • Next message: Kevin Menard: "Re: Add getHashCode() to CayenneDataObject?"

    Would it make sense to add:

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

    To CayenneDataObject.java? The primary reason is to better support
    Tapestry. In T4, the..or component can take a keyExpression (which is
    parsed by OGNL) which should return the primary key, which gets placed
    in the HTML page (this is used due to stale link exceptions). I don't
    want to expose primary keys in the HTML, though, and using
    "objectId.hashCode" doesn't work as an OGNL expression since hashCode()
    != getHashCode(). If the above method were added, "hashCode" would work
    as the expression.

    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 &).

    Thanks,

    /dev/mrg



    This archive was generated by hypermail 2.0.0 : Wed Jun 21 2006 - 11:58:32 EDT