Class MySQLPkGenerator
java.lang.Object
org.apache.cayenne.dba.JdbcPkGenerator
org.apache.cayenne.dba.mysql.MySQLPkGenerator
- All Implemented Interfaces:
PkGenerator
-
Field Summary
Fields inherited from class JdbcPkGenerator
adapter, DEFAULT_PK_CACHE_SIZE, pkCache, pkCacheSize, pkStartValueModifier and TypeFieldDescriptionprotected JdbcAdapterstatic final intprotected ConcurrentMap<String, Queue<Long>> protected intprotected long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Stringprotected longgetLongPrimaryKey(Statement statement, String entityName) protected longlongPkFromDatabase(DataNode node, DbEntity entity) Overrides superclass's implementation to perform locking of the primary key lookup table.protected Stringprotected SQLExceptionprocessSQLException(SQLException exception, SQLException parent) Appends a new SQLException to the chain.Methods inherited from class JdbcPkGenerator
autoPkTableExists, createAutoPk, createAutoPkStatements, dropAutoPk, dropAutoPkStatements, generatePk, getAdapter, getPkCacheSize, pkCreateString, pkDeleteString, pkSelectString, pkUpdateString, reset, runUpdate, setAdapter, setPkCacheSizeModifier and TypeMethodDescriptionprotected booleanautoPkTableExists(DataNode node) Checks if AUTO_PK_TABLE already exists in the database.voidcreateAutoPk(DataNode node, List<DbEntity> dbEntities) Generates necessary database objects to provide automatic primary key support.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.voiddropAutoPk(DataNode node, List<DbEntity> dbEntities) Drops table named "AUTO_PK_SUPPORT" if it exists in the database.dropAutoPkStatements(List<DbEntity> dbEntities) Returns SQL string needed to drop database objects associated with automatic primary key generation.generatePk(DataNode node, DbAttribute pk) Generates a unique and non-repeating primary key for specified dbEntity.Get an adapter associated with current PkGeneratorintReturns a size of the entity primary key cache.protected StringpkCreateString(String entName) protected StringpkDeleteString(List<DbEntity> dbEntities) protected StringpkSelectString(String entName) protected StringpkUpdateString(String entName) voidreset()Resets any cached primary keys forcing generator to go to the database next time id generation is requested.intRuns JDBC update over a Connection obtained from DataNode.voidsetAdapter(DbAdapter adapter) Install the adapter associated with current PkGeneratorvoidsetPkCacheSize(int pkCacheSize) Sets the size of the entity primary key cache.
-
Constructor Details
-
MySQLPkGenerator
public MySQLPkGenerator()Used by DI- Since:
- 4.1
-
-
Method Details
-
longPkFromDatabase
Overrides superclass's implementation to perform locking of the primary key lookup table.- Overrides:
longPkFromDatabasein classJdbcPkGenerator- Throws:
Exception- Since:
- 3.0
-
processSQLException
Appends a new SQLException to the chain. If parent is null, uses the exception as the chain root. -
dropAutoPkString
- Overrides:
dropAutoPkStringin classJdbcPkGenerator
-
pkTableCreateString
- Overrides:
pkTableCreateStringin classJdbcPkGenerator
-
getLongPrimaryKey
- Throws:
SQLException- Since:
- 3.0
-