Re: Temporary Objects

From: Mike Kienenberger (mkienen..mail.com)
Date: Tue Mar 27 2007 - 15:44:11 EDT

  • Next message: Peter Karich: "Re: Temporary Objects"

    I'm missing something. I don't understand why you don't do something
    along these lines.

    nonpersistentObject.setObjectId(new Timestamp());

    You don't have to use the same kinds of object ids for your
    non-persistent objects, and using a different type will guarantee that
    a persistent and non-persistent object will never be equal to each
    other.

    On 3/27/07, Peter Karich <peatha..ahoo.de> wrote:
    > Thank you both Mike and Bryan!
    >
    > Mike Kienenberger schrieb:
    > > What about creating and setting your own ObjectID values for your
    > > non-persistent components?
    >
    > Yes, I though about that, but the persistent objects should also have
    > this sort of ID. But then I need a database stored counter to avoid that
    > the objectID starts from 0 on every new program start. And so the
    > database generated ID would make this job.
    >
    >
    > Bryan Maine schrieb:
    > > Anyway, if you need to do it, this code works: ...
    >
    > This sort of code works fine. The problem is that it only works with
    > persistent objects...
    >
    > Hmmh,
    > through the discussion I think I should NOT use the ID's!
    >
    > So if the following is true under ALL circumstances (get the objects
    > from different context or sth.) then I am satisfied:
    >
    > if "obj1 == obj2" then "pk(obj1) == pk(obj2)"
    >
    > AND if "pk(obj1) == pk(obj2)" then "obj1 == obj2".
    >
    > I think the first line is always true, what about the second?
    > Then I can create a SimilarEntry which holds a TimeInterval and
    > "overloads" the equals method by comparing by the pointers ("obj1 ==
    > obj2") and do not need the ID's.
    >
    > Thank you,
    > Peter Karich.
    >
    >
    >
    >
    >
    > ___________________________________________________________
    > Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: http://mail.yahoo.de
    >



    This archive was generated by hypermail 2.0.0 : Tue Mar 27 2007 - 15:44:44 EDT