Problem setting FK

From: johannes schmidt (e002753..tudent.tuwien.ac.at)
Date: Thu May 27 2004 - 08:27:47 EDT

  • Next message: Andrus Adamchik: "Re: missing toOne"

    Hi!
    I've got a really strange problem using cayenne 1.0.
    I have a m:n Relationship between Gliederung and Person.
    When I run the following code,

    1:
    this.db.setGliederung((Gliederung)this.dbcGliederung.getSelectedItem());
    2: this.db.setPerson(this.dbp.getPerson());
    3: ctxt.commitChanges();

    i get the following exception on line 3:

    org.objectstyle.cayenne.CayenneRuntimeException: [v.1.0 September 20 2003]
    Some parts of FK are missing in snapshot.

    Why does this happen?
    The state of person is the following:
      {

    [...]

    ]<oid: akj.database.cayenneDataObjects.Person: <P_ID: null>; state:
    committed>}

    Although the object is commited to the database, P_ID (the ID of the object
    in the Database) is still null. How is this possible? How can I force
    cayenne to generate an ID for the object?????
    What is interesting: when I unregister the object and reload it "by hand"
    from the database, the above code works perfectly.
    But ctxt.refetch(...) does NOT work.
    Anybody out there who can help me?

    thx, johannes



    This archive was generated by hypermail 2.0.0 : Thu May 27 2004 - 08:29:45 EDT