IngresPkGenerator (cayenne-doc: Cayenne Documentation 5.0-M2 API)
Description: declaration: package: org.apache.cayenne.dba.ingres, class: IngresPkGenerator

# Class IngresPkGenerator

java.lang.Object
org.apache.cayenne.dba.JdbcPkGenerator
org.apache.cayenne.dba.oracle.OraclePkGenerator
org.apache.cayenne.dba.ingres.IngresPkGenerator

All Implemented Interfaces:
  `PkGenerator`

public class IngresPkGenerator extends OraclePkGenerator
Ingres-specific sequence based PK generator.

Since:
  1.2

- ## Field Summary

  ### Fields inherited from class JdbcPkGenerator

  `adapter, DEFAULT_PK_CACHE_SIZE, pkCache, pkCacheSize, pkStartValue`
  Modifier and Type
  Field
  Description
  `protected JdbcAdapter`
  `adapter`
  `static final int`
  `DEFAULT_PK_CACHE_SIZE`
  `protected ConcurrentMap<String, Queue<Long>>`
  `pkCache`
  `protected int`
  `pkCacheSize`
  `protected long`
  `pkStartValue`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  ``
  `IngresPkGenerator()`
  Used by DI
  `protected`
  `IngresPkGenerator(JdbcAdapter adapter)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected String`
  `selectAllSequencesQuery()`
  `protected String`
  `selectNextValQuery(String sequenceName)`

  ### Methods inherited from class OraclePkGenerator

  `createAutoPk, createAutoPkStatements, createSequenceString, dropAutoPk, dropAutoPkStatements, dropSequenceString, getExistingSequences, getSequencePrefix, longPkFromDatabase, pkCacheSize, sequenceName`
  Modifier and Type
  Method
  Description
  `void`
  `createAutoPk(DataNode node, List<DbEntity> dbEntities)`
  Generates necessary database objects to provide automatic primary key support.
  `List<String>`
  `createAutoPkStatements(List<DbEntity> dbEntities)`
  Creates a list of CREATE SEQUENCE statements for the list of DbEntities.
  `protected String`
  `createSequenceString(DbEntity ent)`
  `void`
  `dropAutoPk(DataNode node, List<DbEntity> dbEntities)`
  Drops PK sequences for all specified DbEntities.
  `List<String>`
  `dropAutoPkStatements(List<DbEntity> dbEntities)`
  Creates a list of DROP SEQUENCE statements for the list of DbEntities.
  `protected String`
  `dropSequenceString(DbEntity ent)`
  Returns a SQL string needed to drop any database objects associated with automatic primary key generation process for a specific DbEntity.
  `protected List<String>`
  `getExistingSequences(DataNode node)`
  Fetches a list of existing sequences that might match Cayenne generated ones.
  `protected String`
  `getSequencePrefix()`
  `protected long`
  `longPkFromDatabase(DataNode node, DbEntity entity)`
  Generates primary key by calling Oracle sequence corresponding to the `dbEntity`.
  `protected int`
  `pkCacheSize(DbEntity entity)`
  `protected String`
  `sequenceName(DbEntity entity)`
  Returns expected primary key sequence name for a DbEntity.

  ### Methods inherited from class JdbcPkGenerator

  `autoPkTableExists, dropAutoPkString, generatePk, getAdapter, getPkCacheSize, pkCreateString, pkDeleteString, pkSelectString, pkTableCreateString, pkUpdateString, reset, runUpdate, setAdapter, setPkCacheSize`
  Modifier and Type
  Method
  Description
  `protected boolean`
  `autoPkTableExists(DataNode node)`
  Checks if AUTO_PK_TABLE already exists in the database.
  `protected String`
  `dropAutoPkString()`
  `Object`
  `generatePk(DataNode node, DbAttribute pk)`
  Generates a unique and non-repeating primary key for specified dbEntity.
  `JdbcAdapter`
  `getAdapter()`
  Get an adapter associated with current PkGenerator
  `int`
  `getPkCacheSize()`
  Returns a size of the entity primary key cache.
  `protected String`
  `pkCreateString(String entName)`
  `protected String`
  `pkDeleteString(List<DbEntity> dbEntities)`
  `protected String`
  `pkSelectString(String entName)`
  `protected String`
  `pkTableCreateString()`
  `protected String`
  `pkUpdateString(String entName)`
  `void`
  `reset()`
  Resets any cached primary keys forcing generator to go to the database next time id generation is requested.
  `int`
  `runUpdate(DataNode node, String sql)`
  Runs JDBC update over a Connection obtained from DataNode.
  `void`
  `setAdapter(DbAdapter adapter)`
  Install the adapter associated with current PkGenerator
  `void`
  `setPkCacheSize(int pkCacheSize)`
  Sets the size of the entity primary key cache.

  ### Methods inherited from class Object

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

- ## Constructor Details

  - ### IngresPkGenerator

    public IngresPkGenerator()
    Used by DI
    Since:
      4.1

  - ### IngresPkGenerator

    protected IngresPkGenerator(JdbcAdapter adapter)

- ## Method Details

  - ### selectNextValQuery

    protected String selectNextValQuery(String sequenceName)
    Overrides:
      `selectNextValQuery` in class `OraclePkGenerator`

  - ### selectAllSequencesQuery

    protected String selectAllSequencesQuery()
    Overrides:
      `selectAllSequencesQuery` in class `OraclePkGenerator`