Re: DB2 cached sequence numbers

From: Derek Rendall (dere..sure.com)
Date: Wed Oct 20 2004 - 21:18:46 EDT

  • Next message: Pierce Krouse: "what if my database is somewhere else?"

    aargh - never mind, my post was due to a red herring. My jUnit test created
    a new dataContext for each run. It jumped the ids by 20 for each run, and
    then I got confused with the statement on the UI and thinking of our old EJB
    based id generator (which of course stayed round after each jUnit test :-) I
    discovered my error by another, deeper look at the code (will teach me to
    base posts on late night testing :-)

    Apologies

    Derek

    ----- Original Message -----
    From: "Derek Rendall" <dere..sure.com>
    To: <cayenne-use..bjectstyle.org>
    Sent: Thursday, October 21, 2004 1:58 PM
    Subject: DB2 cached sequence numbers

    > Hi
    >
    > 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 :-).
    >
    > Thanks
    >
    > Derek



    This archive was generated by hypermail 2.0.0 : Wed Oct 20 2004 - 21:18:50 EDT