Re: Postgres Sequence PK Support?

From: Kevin Menard (kmenar..ervprise.com)
Date: Tue Mar 08 2005 - 13:38:23 EST

  • Next message: Andrus Adamchik: "Re: Serialization questions"

    On 3/8/05 10:10 AM, "Michael Engelhart" <moosebrookfar..mail.com> wrote:

    > I too will test this out. One question I have (sorry new to Cayenne)
    > is in the patch it hard codes the sequence start value at 200?

    The short answer is because that's what Cayenne uses elsewhere (e.g., the
    Oracle PK generator), so I was being consistent with that. Why 200 is used,
    I don't know, so maybe Andrus could chime in and elucidate the issue :-)

    > isn't that an optional value. Also when you're using a legacy
    > PostgreSQL sequence, why not allow the option to use existing
    > sequences. As I said I'm a newbie so I don't know if there is another
    > way to do this. Is there?

    You can use an existing sequence using custom Pk generation. The modeler
    says that this only works with Oracle, but it seems to work fine with
    Postgres with this patch applied. I would think the same caveats about
    doing such with Oracle apply here. Namely:

    When using Cayenne key caching mechanism, make sure that sequences in
    the
    database have "INCREMENT BY" greater or equal to OraclePkGenerator
    "pkCacheSize" property value. If this is not the case, you will need to

    adjust PkGenerator value accordingly. For example when sequence is

    incremented by 1 each time, use the following code:

    dataNode.getAdapter().getPkGenerator().setPkCacheSize(1);

    -- 
    Kevin
    



    This archive was generated by hypermail 2.0.0 : Tue Mar 08 2005 - 13:38:44 EST