public class DB2PkGenerator extends JdbcPkGenerator
DB2Adapter
.adapter, DEFAULT_PK_CACHE_SIZE, pkCache, pkCacheSize, pkStartValue
Modifier and Type | Method and 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 entity)
Returns CREATE SEQUENCE statement for entity.
|
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 entity)
Returns DROP SEQUENCE statement.
|
protected List<String> |
getExistingSequences(DataNode node)
Fetches a list of existing sequences that might match Cayenne generated ones.
|
protected long |
longPkFromDatabase(DataNode node,
DbEntity entity)
Performs primary key generation ignoring cache.
|
protected String |
sequenceName(DbEntity entity)
Returns default sequence name for DbEntity.
|
autoPkTableExists, dropAutoPkString, generatePk, getAdapter, getPkCacheSize, pkCreateString, pkDeleteString, pkSelectString, pkTableCreateString, pkUpdateString, reset, runUpdate, setPkCacheSize
protected long longPkFromDatabase(DataNode node, DbEntity entity) throws Exception
JdbcPkGenerator
This method is called internally from "generatePkForDbEntity" and then generated range of key values is saved in cache for performance. Subclasses that implement different primary key generation solutions should override this method, not "generatePkForDbEntity".
longPkFromDatabase
in class JdbcPkGenerator
Exception
public void createAutoPk(DataNode node, List<DbEntity> dbEntities) throws Exception
PkGenerator
createAutoPk
in interface PkGenerator
createAutoPk
in class JdbcPkGenerator
node
- node that provides access to a DataSource.dbEntities
- a list of entities that require primary key auto-generation
supportException
public List<String> createAutoPkStatements(List<DbEntity> dbEntities)
createAutoPkStatements
in interface PkGenerator
createAutoPkStatements
in class JdbcPkGenerator
public void dropAutoPk(DataNode node, List<DbEntity> dbEntities) throws Exception
dropAutoPk
in interface PkGenerator
dropAutoPk
in class JdbcPkGenerator
node
- node that provides access to a DataSource.dbEntities
- a list of entities whose primary key auto-generation support
should be dropped.Exception
public List<String> dropAutoPkStatements(List<DbEntity> dbEntities)
dropAutoPkStatements
in interface PkGenerator
dropAutoPkStatements
in class JdbcPkGenerator
protected List<String> getExistingSequences(DataNode node) throws SQLException
SQLException
protected String sequenceName(DbEntity entity)
protected String dropSequenceString(DbEntity entity)
Copyright © 2001–2018 Apache Cayenne. All rights reserved.