Key generator question

From: Fabricio Voznika (fabricio.voznik..artmouth.EDU)
Date: Tue Mar 04 2003 - 14:08:48 EST

  • Next message: Andrus Adamchik: "Re: Key generator question"

    Hi,

       Does anyone know if it's possible to use a custom oracle sequence to
    generate PKs? The following lines were extracted from data-map.dtd:

    <db-key-generator>
     <db-generator-type>ORACLE</db-generator-type>
     <db-generator-name>test_sequence</db-generator-name>
     <db-key-cache-size>10</db-key-cache-size>
    </db-key-generator>

    however noone seems to use it -- a grep for "key-generator" returns
    nothing and code for OraclePkGenerator.sequencyName():

       protected String sequenceName(DbEntity ent) {
           String entName = ent.getName();
           String seqName = _SEQUENCE_PREFIX + entName.toLowerCase();

           if (ent.getSchema() != null && ent.getSchema().length() > 0) {
               seqName = ent.getSchema() + "." + seqName;
           }

           return seqName;
       }

    I have to work with a legacy database, and can't change anything :-( so
    changing the sequence name to mach PK_attribname is not an option for me.
    Also, can I use sequence generator with composite keys, i.e. ID and name
    as PK?

    Thanks for your help,

    -- 
    Fabricio Voznika
    Senior Programmer/Analyst
    Administrative Computing
    Dartmouth College
    Phone: 603-646-2007
    



    This archive was generated by hypermail 2.0.0 : Tue Mar 04 2003 - 14:13:35 EST