Re: My local Cayenne changes

From: Andriy Shapochka (ashapochk..otmail.com)
Date: Sat Jan 04 2003 - 08:38:27 EST

  • Next message: Andriy Shapochka: "Re: Contributions to Cayenne"

    ----- Original Message -----
    From: "Andrus" <andru..bjectstyle.org>

    > 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.

    Well, theoretically there is a way to find out its value in JDBC. Since JSDK
    1.4 java.sql.Statement defines the method:
    public ResultSet getGeneratedKeys() throws SQLException

    namely for this purpose. I suspect though, very few vendors of JDBC drivers
    could boast of having it implemented.

    Also, probably one can try to deal with the problem inserting new objects
    via updatable result sets.
    Of course, when a stored procedure is used to insert a new record it can
    return the generated value as an OUT parameter.



    This archive was generated by hypermail 2.0.0 : Sat Jan 04 2003 - 08:38:14 EST