Re: Creating new object in validateForInsert or validateForSave

From: Alexander Lamb (dev) ("Alexander)
Date: Wed Jan 17 2007 - 04:50:25 EST

  • Next message: Andrus Adamchik: "Re: Creating new object in validateForInsert or validateForSave"

    Thanks, that's a good news since I didn't see any "awakeFromInsert"
    or "awakeFromFetch" on DataObject as it was the case in EOF (where I
    would have done that kind of work).

    Alex

    On Jan 17, 2007, at 8:53 AM, Andrus Adamchik wrote:

    > Hi Alex,
    >
    > Yes you can do that. Validation routine is executed before object
    > changes are finalized, allowing arbitrary object operations to be
    > performed during the validation.
    >
    > Andrus
    >
    >
    > On Jan 17, 2007, at 12:07 AM, Alexander Lamb (dev) wrote:
    >
    >> Hello list,
    >>
    >> I am currently using Cayenne 2.0.
    >>
    >> I read it was possible to modify objects during a
    >> validateForInsert or validateForSave call (e.g. not the same as
    >> old WebObjects).
    >>
    >> What about creating a new object and inserting it in the
    >> DataContext? Will it get saved at the same time?
    >>
    >> My problem is the following:
    >>
    >> I have an object which has a to-one relationship to another
    >> object. That other object has to be created at the same time as
    >> the first one. I would like to make it automatic so the user of
    >> the library I am writing can simply create and insert the first
    >> object and the second one will follow.
    >>
    >> To understand why I am creating two objects related one-to-one it
    >> is because I have an entity which can be related (to-one) to
    >> either one of four other entities. I am doing this instead of
    >> modeling things with a class hierarchy since cayenne doesn't
    >> support multiple tables class hierarchies.
    >>
    >> Thanks for any hints!
    >>
    >> Alex
    >>
    >



    This archive was generated by hypermail 2.0.0 : Wed Jan 17 2007 - 04:51:24 EST