Re: My local Cayenne changes

From: Andrus (andru..bjectstyle.org)
Date: Sat Jan 04 2003 - 00:38:39 EST

  • Next message: Dirk Olmes: "Re: My local Cayenne changes"

    I know, this is a fundamental problem. I just never say "it is impossible"
    about purely programmatic limitations :-).

    You are right about JDBC limitation. I guess I was wondering more about a
    possibility to get a hold of a generated PK via RDBMS specific "tricks".
    For instance, when inserts are done via stored procedure (maybe Cayenne
    will support this someday), it can return the PK. But I am not aware of any
    ways to "learn" the PK even at that level.

    Andrus

    At 06:21 AM 1/4/2003 +0100, Dirk Olmes wrote:
    >>Using opaque database mechanisms for the primary key generation was
    >>intentionally "overlooked" in Cayenne. The reason being a problem of
    >>retrieving the value, that was just assigned to the inserted row, back
    >>into the object on the Java side. This is absolutely essential for the O/R.
    >
    >The baseline is absolutely simlpe: it will never ever work.
    >The purpose of a primary key is to uniquely identify a database row. If
    >you don't know the PK, you don't know the identity of that row.
    >
    >Suppose you insert a new row into the database with colums a, b and c. If
    >you just select from table where a = <value of a> and b = <value of b> and
    >c = <value of c> you can't be sure that there isn't more than one row in
    >the DB with these values. How do you decide which one is the newly created row?
    >
    >Even worse: this problem does not only apply to O/R mapping. How would you
    >handle such a problem when programming plain JDBC?
    >
    >-dirk



    This archive was generated by hypermail 2.0.0 : Sat Jan 04 2003 - 00:37:30 EST