Re: Temporary Objects

From: Peter Karich (peatha..ahoo.de)
Date: Tue Mar 27 2007 - 08:16:50 EDT

  • Next message: Mike Kienenberger: "Re: Temporary Objects"

    Hallo Ari!

    >> How can I get the next autogenerated ID for a special
    >> table from cayenne? Because I want that even unregistered objects can
    >> have an ID.
    >
    > Objects will only be given their primary key after they are committed to
    > the database. However 9 times out of 10, users new to Cayenne who want
    > to use the pk for something find that there is a better way which
    > doesn't involve using the primary key. What do you want to do with the pk?

    The problem is that two TimeInterval's could be the same (with .equals)
    although they are not identical (same ID).
    And now I need to decide in my application, wether they are identical
    TimeIntervals.
    Assume the following (all specified TI's have different ID's):

    set1.add(timeInterval1);
    set1.add(timeInterval2);
    set1.add(timeInterval3);

    assertEquals(3, set1.size());

    This can fail (e.g. timeInterval2.equals(timeInterval3) == true then
    size == 2), because the set relies on equal.
    Now I thought if I put the TimeTnterval's in a map, which has the ID as
    keys this could solve the problem.
    But now the problem was that not all TimeInterval are persistent,
    because most of them I need for some calculation and not for persistence....

    Is there another approach?

    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 - 08:18:16 EDT