|
|||||||||
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
PK Generator for IBM DB2 using sequences.
Field Summary | |
---|---|
static java.lang.String |
SEQUENCE_PREFIX
|
Fields inherited from class org.apache.cayenne.dba.JdbcPkGenerator |
---|
DEFAULT_PK_CACHE_SIZE, NEXT_ID, objDesc, pkCache, pkCacheSize, resultDesc |
Constructor Summary | |
---|---|
DB2PkGenerator()
|
Method Summary | |
---|---|
void |
createAutoPk(DataNode node,
java.util.List dbEntities)
Generates necessary database objects to provide automatic primary key support. |
java.util.List |
createAutoPkStatements(java.util.List dbEntities)
Returns a list of SQL strings needed to generates database objects to provide automatic primary support for the list of entities. |
protected java.lang.String |
createSequenceString(DbEntity ent)
Creates SQL needed for creating a sequence. |
void |
dropAutoPk(DataNode node,
java.util.List dbEntities)
Drops table named "AUTO_PK_SUPPORT" if it exists in the database. |
java.util.List |
dropAutoPkStatements(java.util.List dbEntities)
Returns SQL string needed to drop database objects associated with automatic primary key generation. |
protected java.lang.String |
dropSequenceString(DbEntity ent)
Creates SQL needed for dropping a sequence. |
protected java.util.List |
getExistingSequences(DataNode node)
Returns a List of all existing, accessible sequences. |
protected int |
pkFromDatabase(DataNode node,
DbEntity ent)
Creates a new PK from a sequence returned by
SELECT NEXTVAL FOR sequence_name FROM SYSIBM.SYSDUMMY1
SYSIBM.SYSDUMMY1 corresponds to DUAL in Oracle. |
protected java.lang.String |
sequenceName(DbEntity ent)
Returns the sequence name for a given table name. |
Methods inherited from class org.apache.cayenne.dba.JdbcPkGenerator |
---|
autoPkTableExists, binaryPK, dropAutoPkString, generatePkForDbEntity, generatePkForDbEntityString, 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 java.lang.String SEQUENCE_PREFIX
Constructor Detail |
---|
public DB2PkGenerator()
Method Detail |
---|
public void createAutoPk(DataNode node, java.util.List dbEntities) throws java.lang.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
java.lang.Exception
public java.util.List createAutoPkStatements(java.util.List dbEntities)
PkGenerator
createAutoPkStatements
in interface PkGenerator
createAutoPkStatements
in class JdbcPkGenerator
public void dropAutoPk(DataNode node, java.util.List dbEntities) throws java.lang.Exception
JdbcPkGenerator
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.
java.lang.Exception
public java.util.List dropAutoPkStatements(java.util.List dbEntities)
PkGenerator
dropAutoPkStatements
in interface PkGenerator
dropAutoPkStatements
in class JdbcPkGenerator
protected java.lang.String sequenceName(DbEntity ent)
protected java.lang.String createSequenceString(DbEntity ent)
protected java.lang.String dropSequenceString(DbEntity ent)
protected int pkFromDatabase(DataNode node, DbEntity ent) throws java.lang.Exception
SELECT NEXTVAL FOR sequence_name FROM SYSIBM.SYSDUMMY1
SYSIBM.SYSDUMMY1 corresponds to DUAL in Oracle.
pkFromDatabase
in class JdbcPkGenerator
java.lang.Exception
protected java.util.List getExistingSequences(DataNode node) throws java.sql.SQLException
java.sql.SQLException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |