Class DerbyPkGenerator
java.lang.Object
org.apache.cayenne.dba.JdbcPkGenerator
org.apache.cayenne.dba.oracle.OraclePkGenerator
org.apache.cayenne.dba.derby.DerbyPkGenerator
- All Implemented Interfaces:
PkGenerator
PK generator for Derby that uses sequences.
- Since:
- 4.0 (old one used AUTO_PK_SUPPORT table)
-
Field Summary
Fields inherited from class JdbcPkGenerator
adapter, DEFAULT_PK_CACHE_SIZE, pkCache, pkCacheSize, pkStartValueModifier and TypeFieldDescriptionprotected JdbcAdapterstatic final intprotected ConcurrentMap<String, Queue<Long>> protected intprotected long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringcreateSequenceString(DbEntity entity) protected StringdropSequenceString(DbEntity entity) Returns a SQL string needed to drop any database objects associated with automatic primary key generation process for a specific DbEntity.protected Stringprotected StringselectNextValQuery(String pkGeneratingSequenceName) protected StringsequenceName(DbEntity entity) Returns expected primary key sequence name for a DbEntity.Methods inherited from class OraclePkGenerator
createAutoPk, createAutoPkStatements, dropAutoPk, dropAutoPkStatements, getExistingSequences, getSequencePrefix, longPkFromDatabase, pkCacheSizeModifier and TypeMethodDescriptionvoidcreateAutoPk(DataNode node, List<DbEntity> dbEntities) Generates necessary database objects to provide automatic primary key support.createAutoPkStatements(List<DbEntity> dbEntities) Creates a list of CREATE SEQUENCE statements for the list of DbEntities.voiddropAutoPk(DataNode node, List<DbEntity> dbEntities) Drops PK sequences for all specified DbEntities.dropAutoPkStatements(List<DbEntity> dbEntities) Creates a list of DROP SEQUENCE statements for the list of DbEntities.getExistingSequences(DataNode node) Fetches a list of existing sequences that might match Cayenne generated ones.protected Stringprotected longlongPkFromDatabase(DataNode node, DbEntity entity) Generates primary key by calling Oracle sequence corresponding to thedbEntity.protected intpkCacheSize(DbEntity entity) Methods inherited from class JdbcPkGenerator
autoPkTableExists, dropAutoPkString, generatePk, getAdapter, getPkCacheSize, pkCreateString, pkDeleteString, pkSelectString, pkTableCreateString, pkUpdateString, reset, runUpdate, setAdapter, setPkCacheSizeModifier and TypeMethodDescriptionprotected booleanautoPkTableExists(DataNode node) Checks if AUTO_PK_TABLE already exists in the database.protected StringgeneratePk(DataNode node, DbAttribute pk) Generates a unique and non-repeating primary key for specified dbEntity.Get an adapter associated with current PkGeneratorintReturns a size of the entity primary key cache.protected StringpkCreateString(String entName) protected StringpkDeleteString(List<DbEntity> dbEntities) protected StringpkSelectString(String entName) protected Stringprotected StringpkUpdateString(String entName) voidreset()Resets any cached primary keys forcing generator to go to the database next time id generation is requested.intRuns JDBC update over a Connection obtained from DataNode.voidsetAdapter(DbAdapter adapter) Install the adapter associated with current PkGeneratorvoidsetPkCacheSize(int pkCacheSize) Sets the size of the entity primary key cache.
-
Constructor Details
-
DerbyPkGenerator
public DerbyPkGenerator()Used by DI- Since:
- 4.1
-
-
Method Details
-
sequenceName
Description copied from class:OraclePkGeneratorReturns expected primary key sequence name for a DbEntity.- Overrides:
sequenceNamein classOraclePkGenerator
-
selectNextValQuery
- Overrides:
selectNextValQueryin classOraclePkGenerator
-
selectAllSequencesQuery
- Overrides:
selectAllSequencesQueryin classOraclePkGenerator
-
dropSequenceString
Description copied from class:OraclePkGeneratorReturns a SQL string needed to drop any database objects associated with automatic primary key generation process for a specific DbEntity.- Overrides:
dropSequenceStringin classOraclePkGenerator
-
createSequenceString
- Overrides:
createSequenceStringin classOraclePkGenerator
-