|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.cayenne.dba.JdbcPkGenerator
org.apache.cayenne.dba.db2.DB2PkGenerator
public class DB2PkGenerator
A sequence-based PK generator used by DB2Adapter
.
Field Summary | |
---|---|
static String |
SEQUENCE_PREFIX
Deprecated. since 2.0 - other generators do not expose the default prefix. |
Fields inherited from class org.apache.cayenne.dba.JdbcPkGenerator |
---|
DEFAULT_PK_CACHE_SIZE, pkCache, pkCacheSize |
Constructor Summary | |
---|---|
DB2PkGenerator()
|
Method Summary | |
---|---|
void |
createAutoPk(DataNode node,
List dbEntities)
Generates necessary database objects to provide automatic primary key support. |
List |
createAutoPkStatements(List 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 dbEntities)
Drops PK sequences for all specified DbEntities. |
List |
dropAutoPkStatements(List dbEntities)
Creates a list of DROP SEQUENCE statements for the list of DbEntities. |
protected String |
dropSequenceString(DbEntity entity)
Returns DROP SEQUENCE statement. |
protected List |
getExistingSequences(DataNode node)
Fetches a list of existing sequences that might match Cayenne generated ones. |
protected int |
pkFromDatabase(DataNode node,
DbEntity ent)
Performs primary key generation ignoring cache. |
protected String |
sequenceName(DbEntity entity)
Returns default sequence name for DbEntity. |
Methods inherited from class org.apache.cayenne.dba.JdbcPkGenerator |
---|
autoPkTableExists, binaryPK, dropAutoPkString, generatePkForDbEntity, getPkCacheSize, pkCreateString, pkDeleteString, pkSelectString, pkTableCreateString, pkUpdateString, reset, runUpdate, setPkCacheSize |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String SEQUENCE_PREFIX
Constructor Detail |
---|
public DB2PkGenerator()
Method Detail |
---|
protected int pkFromDatabase(DataNode node, DbEntity ent) 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".
pkFromDatabase
in class JdbcPkGenerator
Exception
public void createAutoPk(DataNode node, List 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 autogeneration
support
Exception
public List createAutoPkStatements(List dbEntities)
createAutoPkStatements
in interface PkGenerator
createAutoPkStatements
in class JdbcPkGenerator
public void dropAutoPk(DataNode node, List 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 autogeneration support
should be dropped.
Exception
public List dropAutoPkStatements(List dbEntities)
dropAutoPkStatements
in interface PkGenerator
dropAutoPkStatements
in class JdbcPkGenerator
protected List getExistingSequences(DataNode node) throws SQLException
SQLException
protected String sequenceName(DbEntity entity)
protected String dropSequenceString(DbEntity entity)
protected String createSequenceString(DbEntity entity)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |