Re: testing two DataObjects for equality

From: Mike Kienenberger (mkienen..laska.net)
Date: Fri Feb 11 2005 - 10:21:39 EST

  • Next message: Zvonimir Spajic: "Re: how to store/save not PKs in the join-tables instead of storing the id's"

    Todd O'Bryan <toddobrya..ac.com> wrote:
    > I'm trying to see if the user who logged into an application is the
    > same one who created a certain resource. The resource has a userId
    > column and a relationship that maps to the user table.
    >
    > Can I do
    >
    > loggedInUser().equals(resource.getUser())
    >
    > and will CayenneDataObject do the right thing, or do I need to check
    > PKs or something to check for equality?

    Equality between DataObjects could mean all sorts of different things.

    It could mean that they have the same primary key.
    It could mean that they are identical except for the primary key.
    It could mean that they are completely identical.

    I'm not sure what the exact definition is, but you could find it out by
    looking in the source.

    However, I handle these things in my own code by explictly checking the
    condition I want. I would compare the primary keys (or you might be able
    to just compare the ObjectIds).

    -Mike



    This archive was generated by hypermail 2.0.0 : Fri Feb 11 2005 - 10:21:07 EST