org.apache.cayenne.dba.db2

## Class DB2PkGenerator

- java.lang.Object
- - org.apache.cayenne.dba.JdbcPkGenerator
  - - org.apache.cayenne.dba.oracle.OraclePkGenerator
    - - org.apache.cayenne.dba.db2.DB2PkGenerator

- All Implemented Interfaces:
    PkGenerator

      public class DB2PkGenerator
      extends OraclePkGenerator

  A sequence-based PK generator used by `DB2Adapter`.

- - ### Field Summary

    - ### Fields inherited from class org.apache.cayenne.dba.JdbcPkGenerator

      `adapter, DEFAULT_PK_CACHE_SIZE, pkCache, pkCacheSize, pkStartValue`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DB2PkGenerator()` Used by DI

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected String` | `createSequenceString(DbEntity entity)`
    `protected String` | `dropSequenceString(DbEntity entity)` Returns a SQL string needed to drop any database objects associated with automatic primary key generation process for a specific DbEntity.
    `protected String` | `getSequencePrefix()`
    `protected String` | `selectAllSequencesQuery()`
    `protected String` | `selectNextValQuery(String pkGeneratingSequenceName)`
    `protected String` | `sequenceName(DbEntity entity)` Returns expected primary key sequence name for a DbEntity.

    - ### Methods inherited from class org.apache.cayenne.dba.oracle.OraclePkGenerator

      `createAutoPk, createAutoPkStatements, dropAutoPk, dropAutoPkStatements, getExistingSequences, longPkFromDatabase, pkCacheSize`

    - ### Methods inherited from class org.apache.cayenne.dba.JdbcPkGenerator

      `autoPkTableExists, dropAutoPkString, generatePk, getAdapter, getPkCacheSize, pkCreateString, pkDeleteString, pkSelectString, pkTableCreateString, pkUpdateString, reset, runUpdate, setAdapter, setPkCacheSize`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DB2PkGenerator

          public DB2PkGenerator()

      Used by DI
      Since:
        4.1

  - ### Method Detail

    - #### sequenceName

          protected String sequenceName(DbEntity entity)

      Description copied from class: `OraclePkGenerator`
      Returns expected primary key sequence name for a DbEntity.
      Overrides:
        `sequenceName` in class `OraclePkGenerator`

    - #### getSequencePrefix

          protected String getSequencePrefix()

      Overrides:
        `getSequencePrefix` in class `OraclePkGenerator`

    - #### selectNextValQuery

          protected String selectNextValQuery(String pkGeneratingSequenceName)

      Overrides:
        `selectNextValQuery` in class `OraclePkGenerator`

    - #### selectAllSequencesQuery

          protected String selectAllSequencesQuery()

      Overrides:
        `selectAllSequencesQuery` in class `OraclePkGenerator`

    - #### dropSequenceString

          protected String dropSequenceString(DbEntity entity)

      Description copied from class: `OraclePkGenerator`
      Returns a SQL string needed to drop any database objects associated with automatic primary key generation process for a specific DbEntity.
      Overrides:
        `dropSequenceString` in class `OraclePkGenerator`

    - #### createSequenceString

          protected String createSequenceString(DbEntity entity)

      Overrides:
        `createSequenceString` in class `OraclePkGenerator`

Copyright © 2001–2021 Apache Cayenne. All rights reserved.