|
||||||||||
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.sybase.SybasePkGenerator
public class SybasePkGenerator
Primary key generator implementation for Sybase. Uses a lookup table named "AUTO_PK_SUPPORT" and a stored procedure "auto_pk_for_table" to search and increment primary keys for tables.
Field Summary |
---|
Fields inherited from class org.apache.cayenne.dba.JdbcPkGenerator |
---|
DEFAULT_PK_CACHE_SIZE, pkCache, pkCacheSize |
Constructor Summary | |
---|---|
protected |
SybasePkGenerator()
Deprecated. since 3.0 |
protected |
SybasePkGenerator(JdbcAdapter adapter)
|
Method Summary | |
---|---|
void |
createAutoPk(DataNode node,
List<DbEntity> dbEntities)
Generates database objects to provide automatic primary key support. |
List<String> |
createAutoPkStatements(List<DbEntity> dbEntities)
Returns a list of SQL strings needed to generates database objects to provide automatic primary support for the list of entities. |
void |
dropAutoPk(DataNode node,
List<DbEntity> dbEntities)
Drops database objects related to automatic primary key support. |
List<String> |
dropAutoPkStatements(List<DbEntity> dbEntities)
Returns SQL string needed to drop database objects associated with automatic primary key generation. |
protected long |
longPkFromDatabase(DataNode node,
DbEntity entity)
Performs primary key generation ignoring cache. |
protected int |
pkFromDatabase(DataNode node,
DbEntity ent)
Deprecated. since 3.0 |
protected String |
pkTableCreateString()
|
Methods inherited from class org.apache.cayenne.dba.JdbcPkGenerator |
---|
autoPkTableExists, binaryPK, dropAutoPkString, generatePk, generatePkForDbEntity, getAdapter, getPkCacheSize, pkCreateString, pkDeleteString, pkSelectString, pkUpdateString, reset, runUpdate, setPkCacheSize |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected SybasePkGenerator()
protected SybasePkGenerator(JdbcAdapter adapter)
Method Detail |
---|
protected String pkTableCreateString()
pkTableCreateString
in class JdbcPkGenerator
public void createAutoPk(DataNode node, List<DbEntity> dbEntities) throws Exception
1. Executed only if a corresponding table does not exist in the database.
CREATE TABLE AUTO_PK_SUPPORT ( TABLE_NAME VARCHAR(32) NOT NULL, NEXT_ID DECIMAL(19,0) NOT NULL )
2. Executed under any circumstances.
if exists (SELECT * FROM sysobjects WHERE name = 'auto_pk_for_table') BEGIN DROP PROCEDURE auto_pk_for_table END
3. Executed under any circumstances.
CREATE PROCEDURE auto_pk_for_tablecreateAutoPk
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
support
Exception
public List<String> createAutoPkStatements(List<DbEntity> dbEntities)
PkGenerator
createAutoPkStatements
in interface PkGenerator
createAutoPkStatements
in class JdbcPkGenerator
public void dropAutoPk(DataNode node, List<DbEntity> dbEntities) throws Exception
if exists (SELECT * FROM sysobjects WHERE name = 'AUTO_PK_SUPPORT') BEGIN DROP TABLE AUTO_PK_SUPPORT END if exists (SELECT * FROM sysobjects WHERE name = 'auto_pk_for_table') BEGIN DROP PROCEDURE auto_pk_for_table END
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)
PkGenerator
dropAutoPkStatements
in interface PkGenerator
dropAutoPkStatements
in class JdbcPkGenerator
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
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
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |