Re: DB2 cached sequence numbers

From: Mike Kienenberger (mkienen..laska.net)
Date: Thu Oct 21 2004 - 11:59:18 EDT

  • Next message: Andrus Adamchik: "Re: what if my database is somewhere else?"

    Derek Rendall <dere..sure.com> wrote:
    > I notice that the modeler states that the "Customise primary key
    generation"
    > is "currently ignored by all adapters except Oracle". The application I am

    > looking to convert to Cayenne has its own DB independant way of creating
    > ids. Rather than try to adapt it to the "new" data layer, I thought I
    would
    > go with DB2 sequences (we wont be shifting DB vendors now). What can I do
    to
    > stop each ID being 20 bigger than the last? I could change the sequences
    to
    > increment by 1 - seems a bit of a pity.
    >
    > Can I (just) create and use my own subclass of DB2PkGenerator,
    implementing
    > the pkCacheSize similar to that of the OraclePkGenerator? If so, how do I
    > plug it in? Or do I have to checkout and change the DB2PkGenerator in
    > Cayenne itself?
    >
    > Note: I am not worried (for now) about making sure that any changes to the

    > cached PK size is reflected in any sequence SQL generation code - I am
    happy
    > to manually make sure that I sync any changes from the default of 20 (I
    will
    > probably stick with 20 anyway :-).

    Cayenne makes it easy to implement the "own DB independant way of creating
    ids" as a custom subclass of the adaptor.

    I've never used DB2 and I don't know if cayenne currently supports DB2
    squeuences, but if not, submit a patch to add support for them!

    -Mike



    This archive was generated by hypermail 2.0.0 : Thu Oct 21 2004 - 11:57:55 EDT