Creating new object in validateForInsert or validateForSave

From: Alexander Lamb (dev) ("Alexander)
Date: Tue Jan 16 2007 - 16:07:02 EST

  • Next message: edward pedersson: "Re: nested dataContexts"

    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 : Tue Jan 16 2007 - 16:08:13 EST