Re: [news] Re: Status of MySQL AUTO_INCREMENT Support?

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Thu Mar 31 2005 - 21:44:13 EST

  • Next message: Cris Daniluk: "RE: [news] Re: Status of MySQL AUTO_INCREMENT Support?"

    IMO auto-increment (aka generated keys) addition to JDBC standard is
    there to cause confusion :-) ... Driver support for it ranges from poor
    to non-existent. So on the database end you can have a number of
    mechanisms to get a PK generated on row insert (triggers being one of
    them), but propagating it to Java layer is another story... AFAIK only
    SQLServer and MySQL proprietary mechanisms have JDBC mapping (if you
    know of others, please post it here) ...

    So my advise - use current mechanism based on sequences, esp. since you
    already have them in the DB. And yes, you can assign custom names in
    the Modeler.

    Andrus

    On Mar 31, 2005, at 12:29 PM, David Norwood wrote:

    > Hi,
    >
    > I am using an Oracle DB that has auto-incremented (trigger-generated
    > integer) primary keys for every table. In addition, each table has its
    > own
    > sequence. The trigger will check for a non-zero or null and use that
    > value
    > if it's passed in. In the past, I've had to modify the 2 Cayenne
    > classes
    > (below) to bypass the problem; now it seems that the PK generation is
    > customizable per table.
    >
    > Question is, which is now best practice:
    >
    > 1. Tell Cayenne to pass a NULL as the pk for all tables
    > 2. Oracle-supported auto-increment?
    > 3. Some other way?
    >
    > TIA,
    >
    > -david



    This archive was generated by hypermail 2.0.0 : Thu Mar 31 2005 - 21:44:19 EST