Re: ObjectId immutability?

From: Gili (cowwo..bs.darktech.org)
Date: Sat Sep 03 2005 - 21:03:17 EDT

  • Next message: Andrus Adamchik: "Re: Issue with incrementing"

            So you're saying it isn't safe to use
    this.getObjectId().equals(other.getObjectId()) to compare two objects.

            This question links to my previous discussion of
    getCanonicalInstance(). I want to compare the attributes *excluding* the
    primary key (since it is generated and meaningless).

    Gili

    Mike Kienenberger wrote:
    > In theory is the object-oriented equivalent to a primary key.
    > In practice, they're generally the same.
    > However, it's possible to have TemporaryObjectId subclasses for
    > objects that haven't had a primary key generated yet.
    >
    > It's also possible that in the future ObjectId could change to be
    > something else like a universal ID (pk + timestamp + ip address, etc)
    > to better support clustering.
    >
    > And ObjectID never changes, but an object can be assigned new
    > ObjectIds (I'm pretty sure that's what happens when a new object is
    > assigned a generated key, but I've never looked).
    >
    > -Mike
    >
    > On 9/3/05, Gili <cowwo..bs.darktech.org> wrote:
    >
    >>Hi,
    >>
    >> The implementation of ObjectId caches its hashcode because it says it
    >>is immutable. Does this mean that when a DataObject is modified in
    >>memory, it gets assigned a new ObjectId instance? It would be nice to
    >>mention this somewhere in the Javadoc. This is important because I'm
    >>wondering what ObjectId.equals() means ... it is important for end-users
    >>to know whether this simply compares the primary keys, the values of all
    >>the attributes, etc. Depending on what it does it will have different
    >>usefulness.
    >>
    >>Thank you,
    >>Gili
    >>--
    >>http://www.desktopbeautifier.com/
    >>
    >
    >

    -- 
    http://www.desktopbeautifier.com/
    



    This archive was generated by hypermail 2.0.0 : Sat Sep 03 2005 - 21:03:16 EDT