Re: Primary Key Always Null

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Thu Nov 27 2003 - 03:32:52 EST

  • Next message: James Treleaven: "opaque Primary Keys"

    Hi Gary,

    to answer your question I need to know how the Booking table schema
    looks like. Does it have an independent PK column, and client_id is
    simply an FK? Is "client_id" also a Booking class property (from your
    description it looks like it is)?

    I guess you can send your data map file (*.map.xml). This will provide
    a full picture... You can send it to me directly, I'll take a look in
    the morning.

    Andrus

    On Nov 27, 2003, at 3:20 AM, Gary Jarrel wrote:

    > I've got 2 tables in the database one is the "Client" the other is
    > "Booking". It's a one to many relationship as one client can have many
    > bookings. I generated all the classes using the Cayenne Modeller and
    > everything seems to be working as normal. The problem that I am having
    > as when I want to add a new booking whether by creating a new Client
    > object or retrieving an already existing Client from the database. The
    > steps that I do are as follows:
    >
    > 1. Create a new client object and set all the required fields.
    > 2. Create a new booking object and set all the required fields (except
    > for client)
    > 3. Then I call the "booking.setClient(client)" i.e. adding to the
    > booking object the client object
    > 4. Then I call context.commit()



    This archive was generated by hypermail 2.0.0 : Thu Nov 27 2003 - 03:32:55 EST