Re: many-to-many mapping resulting in incomplete SQL queries

From: Daniel Doppmeier (
Date: Mon May 12 2008 - 12:52:54 EDT

  • Next message: Michael Gentry: "Re: many-to-many mapping resulting in incomplete SQL queries"


    Thanks again. Setting at least one of the attributes as primary key
    solved the problem. As far as I tested, it is not important which of the
    attributes is assigned the primary key, but there has to be at least one
    PK. The PK generation strategy is set to default by the modeller. Any
    changes to that setting do not seem to affect the generated code, so
    everything seems to work just as it should by now.

    Michael Gentry schrieb:
    > [followup back to the user list]
    > Hi Daniel,
    > The first time I ran your test application it did indeed crash with
    > the missing WHERE clause (this is on Cayenne 3.x, too). I went into
    > your Cayenne Model, though, and on your Person_is_author_of_book table
    > (you didn't map it as a class, which is cool since you are flattening
    > it), I checked the PK/Mandatory checkboxes under the Attributes tab
    > for the DbEntity. Then I re-ran the application and it worked:
    > INFO: DELETE FROM Person_is_author_of_book WHERE bookID = ? AND personID = ?
    > May 12, 2008 12:17:06 PM org.apache.cayenne.access.QueryLogger
    > logQueryParameters
    > INFO: [bind: 1->bookID:2, 2->personID:2]
    > Try updating your model and see if it fixes your issue.
    > Thanks,
    > /dev/mrg

    This archive was generated by hypermail 2.0.0 : Mon May 12 2008 - 12:53:34 EDT