Re: cayenne postgres view problem?

From: Dirk Olmes (dirk.olme..mx.de)
Date: Sat Mar 15 2003 - 12:52:16 EST

  • Next message: Halbig Thomas: "coonection lost after idle time"

    > Now I have the problem that every list entry of my 3848 returned
    > objects contains the SAME object
    > (database row result)
    >
    > with a raw query it works fine I get all my 3848 DIFFERNET objects
    > from my view
    >
    > I have no idea what could be wrong

    This looks like a uniqueing problem. You don't have a primary key
    defined for your dbEntity. So I guess what's happening is this: cayenne
    sees the first row and tries to "guess" the primary key for that row.
    All following rows will be uniqued, i.e. the (missing) primary key will
    be recognized and since a matching row was already read, you'll get
    multiple copies of that row in the result set.

    Try adding some kind of primary key to your view (e.g. the
    concatenation of all pimary keys in the entities involved in the view
    creation) and make it a primary key column in your dbEntity. Since you
    don't want to see that synthetic primary key in your object model,
    don't include it in your objEntity.

    You should have received a warning about the missing pk from Cayenne
    Modeler ....

    HTH,

    -dirk



    This archive was generated by hypermail 2.0.0 : Sat Mar 15 2003 - 12:55:51 EST