Package org.apache.cayenne.dba.openbase
Class OpenBasePkGenerator
- java.lang.Object
-
- org.apache.cayenne.dba.JdbcPkGenerator
-
- org.apache.cayenne.dba.openbase.OpenBasePkGenerator
-
- All Implemented Interfaces:
PkGenerator
@Deprecated public class OpenBasePkGenerator extends JdbcPkGenerator
Deprecated.since 4.2- Since:
- 1.1
-
-
Field Summary
-
Fields inherited from class org.apache.cayenne.dba.JdbcPkGenerator
adapter, DEFAULT_PK_CACHE_SIZE, pkCache, pkCacheSize, pkStartValue
-
-
Constructor Summary
Constructors Modifier Constructor Description OpenBasePkGenerator()
Deprecated.Used by DIprotected
OpenBasePkGenerator(JdbcAdapter adapter)
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected boolean
canCreatePK(DbEntity entity)
Deprecated.void
createAutoPk(DataNode node, List<DbEntity> dbEntities)
Deprecated.Generates necessary database objects to provide automatic primary key support.List<String>
createAutoPkStatements(List<DbEntity> dbEntities)
Deprecated.Returns a list of SQL strings needed to generates database objects to provide automatic primary support for the list of entities.protected String
createPKString(DbEntity entity)
Deprecated.Returns a String to create PK support for an entity.protected String
createUniquePKIndexString(DbEntity entity)
Deprecated.Returns a String to create a unique index on table primary key columns per OpenBase recommendations.void
dropAutoPk(DataNode node, List<DbEntity> dbEntities)
Deprecated.Drops table named "AUTO_PK_SUPPORT" if it exists in the database.List<String>
dropAutoPkStatements(List<DbEntity> dbEntities)
Deprecated.Returns an empty list, since OpenBase doesn't support this operation.Object
generatePk(DataNode node, DbAttribute pk)
Deprecated.Returns a non-repeating primary key for a given PK attribute.int
getPkCacheSize()
Deprecated.Returns zero, since PK caching is not feasible with OpenBase PK generation mechanism.protected long
longPkFromDatabase(DataNode node, DbEntity entity)
Deprecated.Generates new (unique and non-repeating) primary key for specified DbEntity.protected String
newIDString(DbEntity ent)
Deprecated.Returns SQL string that can generate new (unique and non-repeating) primary key for specified DbEntity.void
reset()
Deprecated.Resets any cached primary keys forcing generator to go to the database next time id generation is requested.void
setPkCacheSize(int pkCacheSize)
Deprecated.Sets the size of the entity primary key cache.-
Methods inherited from class org.apache.cayenne.dba.JdbcPkGenerator
autoPkTableExists, dropAutoPkString, getAdapter, pkCreateString, pkDeleteString, pkSelectString, pkTableCreateString, pkUpdateString, runUpdate, setAdapter
-
-
-
-
Constructor Detail
-
OpenBasePkGenerator
public OpenBasePkGenerator()
Deprecated.Used by DI- Since:
- 4.1
-
OpenBasePkGenerator
protected OpenBasePkGenerator(JdbcAdapter adapter)
Deprecated.
-
-
Method Detail
-
generatePk
public Object generatePk(DataNode node, DbAttribute pk) throws Exception
Deprecated.Returns a non-repeating primary key for a given PK attribute. Since OpenBase-specific mechanism is used, key caching is disabled. Instead a database operation is performed on every call.- Specified by:
generatePk
in interfacePkGenerator
- Overrides:
generatePk
in classJdbcPkGenerator
- Throws:
Exception
- Since:
- 3.0
-
longPkFromDatabase
protected long longPkFromDatabase(DataNode node, DbEntity entity) throws Exception
Deprecated.Generates new (unique and non-repeating) primary key for specified DbEntity. Executed SQL looks like this:NEWID FOR Table Column
COLUMN must be marked as UNIQUE in order for this to work properly.
- Overrides:
longPkFromDatabase
in classJdbcPkGenerator
- Throws:
Exception
- Since:
- 3.0
-
newIDString
protected String newIDString(DbEntity ent)
Deprecated.Returns SQL string that can generate new (unique and non-repeating) primary key for specified DbEntity. No actual database operations are performed.- Since:
- 1.2
-
createAutoPk
public void createAutoPk(DataNode node, List<DbEntity> dbEntities) throws Exception
Deprecated.Description copied from interface:PkGenerator
Generates necessary database objects to provide automatic primary key support.- Specified by:
createAutoPk
in interfacePkGenerator
- Overrides:
createAutoPk
in classJdbcPkGenerator
- Parameters:
node
- node that provides access to a DataSource.dbEntities
- a list of entities that require primary key auto-generation support- Throws:
Exception
-
createAutoPkStatements
public List<String> createAutoPkStatements(List<DbEntity> dbEntities)
Deprecated.Description copied from interface: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.- Specified by:
createAutoPkStatements
in interfacePkGenerator
- Overrides:
createAutoPkStatements
in classJdbcPkGenerator
-
canCreatePK
protected boolean canCreatePK(DbEntity entity)
Deprecated.
-
dropAutoPk
public void dropAutoPk(DataNode node, List<DbEntity> dbEntities) throws Exception
Deprecated.Description copied from class:JdbcPkGenerator
Drops table named "AUTO_PK_SUPPORT" if it exists in the database.- Specified by:
dropAutoPk
in interfacePkGenerator
- Overrides:
dropAutoPk
in classJdbcPkGenerator
- Parameters:
node
- node that provides access to a DataSource.dbEntities
- a list of entities whose primary key auto-generation support should be dropped.- Throws:
Exception
-
dropAutoPkStatements
public List<String> dropAutoPkStatements(List<DbEntity> dbEntities)
Deprecated.Returns an empty list, since OpenBase doesn't support this operation.- Specified by:
dropAutoPkStatements
in interfacePkGenerator
- Overrides:
dropAutoPkStatements
in classJdbcPkGenerator
-
createPKString
protected String createPKString(DbEntity entity)
Deprecated.Returns a String to create PK support for an entity.
-
createUniquePKIndexString
protected String createUniquePKIndexString(DbEntity entity)
Deprecated.Returns a String to create a unique index on table primary key columns per OpenBase recommendations.
-
reset
public void reset()
Deprecated.Description copied from interface:PkGenerator
Resets any cached primary keys forcing generator to go to the database next time id generation is requested. May not be applicable for all generator implementations.- Specified by:
reset
in interfacePkGenerator
- Overrides:
reset
in classJdbcPkGenerator
-
getPkCacheSize
public int getPkCacheSize()
Deprecated.Returns zero, since PK caching is not feasible with OpenBase PK generation mechanism.- Overrides:
getPkCacheSize
in classJdbcPkGenerator
-
setPkCacheSize
public void setPkCacheSize(int pkCacheSize)
Deprecated.Description copied from class:JdbcPkGenerator
Sets the size of the entity primary key cache. IfpkCacheSize
parameter is less than 1, cache size is set to "one".Note that our tests show that setting primary key cache value to anything much bigger than 20 does not give any significant performance increase. Therefore it does not make sense to use bigger values, since this may potentially create big gaps in the database primary key sequences in cases like application crashes or restarts.
- Overrides:
setPkCacheSize
in classJdbcPkGenerator
-
-