Re: Working with Transient Objects

From: Elia Morling (eli..amiljen.se)
Date: Tue Jun 29 2004 - 17:29:04 EDT

  • Next message: Derek Rendall: "Rich Client and other J2EE related Qs"

    Ok. I see from the exception that objects need to be created within
    the same DataContext to work together. How do I add make a
    temporary object exist with a DataContext without having it create
    a new field in the database? I can't see any PersistenceStates that
    would do the trick...

    Elia

    ----- Original Message -----
    From: "Elia Morling" <eli..amiljen.se>
    To: <cayenne-use..bjectstyle.org>
    Sent: Tuesday, June 29, 2004 11:20 PM
    Subject: Working with Transient Objects

    > Hi,
    > Here's an example to illustrate my problem. I have a parking lot
    > with 5 cars stored in the database. Every time I start up my
    > application I need to create 5 new cars for the duration of the
    > run only. I don't want to store them in the database so I simply
    > create the objects without a context using regular new().
    >
    > Now I can't make them work with the parking lot, when using:
    >
    > parkinglot.addToCarArray(car);
    >
    > OR
    >
    > car.setParkinglot(parkinglot)
    >
    > Why doesn't this work and what should I do about it? I need to
    > have database cars and non-database cars to co-exist in the
    > parkinglot.
    >
    > Elia
    >
    >
    >



    This archive was generated by hypermail 2.0.0 : Tue Jun 29 2004 - 17:28:58 EDT