Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.objectstyle.cayenne.dba.db2
Class DB2PkGenerator  view DB2PkGenerator download DB2PkGenerator.java

java.lang.Object
  extended byorg.objectstyle.cayenne.dba.JdbcPkGenerator
      extended byorg.objectstyle.cayenne.dba.db2.DB2PkGenerator
All Implemented Interfaces:
org.objectstyle.cayenne.dba.PkGenerator

public class DB2PkGenerator
extends org.objectstyle.cayenne.dba.JdbcPkGenerator

PK Generator for IBM DB2 using sequences.


Nested Class Summary
 
Nested classes inherited from class org.objectstyle.cayenne.dba.JdbcPkGenerator
org.objectstyle.cayenne.dba.JdbcPkGenerator.PkRetrieveProcessor
 
Field Summary
static java.lang.String SEQUENCE_PREFIX
           
 
Fields inherited from class org.objectstyle.cayenne.dba.JdbcPkGenerator
DEFAULT_PK_CACHE_SIZE, NEXT_ID, objDesc, pkCache, pkCacheSize, resultDesc
 
Constructor Summary
DB2PkGenerator()
           
 
Method Summary
 void createAutoPk(org.objectstyle.cayenne.access.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(org.objectstyle.cayenne.map.DbEntity ent)
          Creates SQL needed for creating a sequence.
 void dropAutoPk(org.objectstyle.cayenne.access.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(org.objectstyle.cayenne.map.DbEntity ent)
          Creates SQL needed for dropping a sequence.
protected  java.util.List getExistingSequences(org.objectstyle.cayenne.access.DataNode node)
          Returns a List of all existing, accessible sequences.
protected  int pkFromDatabase(org.objectstyle.cayenne.access.DataNode node, org.objectstyle.cayenne.map.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(org.objectstyle.cayenne.map.DbEntity ent)
          Returns the sequence name for a given table name.
 
Methods inherited from class org.objectstyle.cayenne.dba.JdbcPkGenerator
autoPkTableExists, dropAutoPkString, generatePkForDbEntity, generatePkForDbEntityString, getPkCacheSize, pkCreateString, pkDeleteString, pkSelectString, pkTableCreateString, pkUpdateString, reset, runSelect, runUpdate, setPkCacheSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SEQUENCE_PREFIX

public static final java.lang.String SEQUENCE_PREFIX
See Also:
Constant Field Values
Constructor Detail

DB2PkGenerator

public DB2PkGenerator()
Method Detail

createAutoPk

public void createAutoPk(org.objectstyle.cayenne.access.DataNode node,
                         java.util.List dbEntities)
                  throws java.lang.Exception
Description copied from interface: org.objectstyle.cayenne.dba.PkGenerator
Generates necessary database objects to provide automatic primary key support.


createAutoPkStatements

public java.util.List createAutoPkStatements(java.util.List dbEntities)
Description copied from interface: org.objectstyle.cayenne.dba.PkGenerator
Returns a list of SQL strings needed to generates database objects to provide automatic primary support for the list of entities. No actual database operations are performed.


dropAutoPk

public void dropAutoPk(org.objectstyle.cayenne.access.DataNode node,
                       java.util.List dbEntities)
                throws java.lang.Exception
Description copied from class: org.objectstyle.cayenne.dba.JdbcPkGenerator
Drops table named "AUTO_PK_SUPPORT" if it exists in the database.


dropAutoPkStatements

public java.util.List dropAutoPkStatements(java.util.List dbEntities)
Description copied from interface: org.objectstyle.cayenne.dba.PkGenerator
Returns SQL string needed to drop database objects associated with automatic primary key generation. No actual database operations are performed.


sequenceName

protected java.lang.String sequenceName(org.objectstyle.cayenne.map.DbEntity ent)
Returns the sequence name for a given table name.


createSequenceString

protected java.lang.String createSequenceString(org.objectstyle.cayenne.map.DbEntity ent)
Creates SQL needed for creating a sequence.


dropSequenceString

protected java.lang.String dropSequenceString(org.objectstyle.cayenne.map.DbEntity ent)
Creates SQL needed for dropping a sequence.


pkFromDatabase

protected int pkFromDatabase(org.objectstyle.cayenne.access.DataNode node,
                             org.objectstyle.cayenne.map.DbEntity ent)
                      throws java.lang.Exception
Creates a new PK from a sequence returned by SELECT NEXTVAL FOR sequence_name FROM SYSIBM.SYSDUMMY1 SYSIBM.SYSDUMMY1 corresponds to DUAL in Oracle.


getExistingSequences

protected java.util.List getExistingSequences(org.objectstyle.cayenne.access.DataNode node)
                                       throws java.sql.SQLException
Returns a List of all existing, accessible sequences.