Class OraclePkGenerator

java.lang.Object
org.apache.cayenne.dba.JdbcPkGenerator
org.apache.cayenne.dba.oracle.OraclePkGenerator
All Implemented Interfaces:
PkGenerator
Direct Known Subclasses:
DB2PkGenerator, DerbyPkGenerator, H2PkGenerator, IngresPkGenerator, PostgresPkGenerator, SQLServerPkGenerator

public class OraclePkGenerator extends JdbcPkGenerator
Sequence-based primary key generator implementation for Oracle. Uses Oracle sequences to generate primary key values. This approach is at least 50% faster when tested with Oracle compared to the lookup table approach.

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);
 
  • Constructor Details

    • OraclePkGenerator

      public OraclePkGenerator()
      Used by DI
      Since:
      4.1
    • OraclePkGenerator

      protected OraclePkGenerator(JdbcAdapter adapter)
  • Method Details