public class TableKeyGenerator extends AbstractBeforeKeyGenerator
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_ALLOCATION_SIZE |
static int |
DEFAULT_INITIAL_VALUE |
static String |
DEFAULT_PK_COLUMN_NAME |
static String |
DEFAULT_PK_COLUMN_VALUE |
static String |
DEFAULT_TABLE_NAME |
static String |
DEFAULT_VALUE_COLUMN_NAME |
static String |
DESCRIPTOR_KEY |
Constructor and Description |
---|
TableKeyGenerator(PersistenceFactory factory,
Properties params,
int sqlType)
Creates an instance of this key generator.
|
Modifier and Type | Method and Description |
---|---|
Object |
generateKey(Connection connection,
String tableName,
String primKeyName)
Generate a new key for the specified table.
|
JPATableGeneratorDescriptor |
getDescriptor() |
PersistenceFactory |
getFactory() |
boolean |
isInSameConnection()
Is key generated in the same connection as INSERT?
For DURING_INSERT style this method is never called.
|
bindIdentity, buildStatement, executeStatement
closeSeparateConnection, getSeparateConnection
public static final String DESCRIPTOR_KEY
public static final String DEFAULT_TABLE_NAME
public static final int DEFAULT_ALLOCATION_SIZE
public static final int DEFAULT_INITIAL_VALUE
public static final String DEFAULT_PK_COLUMN_NAME
public static final String DEFAULT_VALUE_COLUMN_NAME
public static final String DEFAULT_PK_COLUMN_VALUE
public TableKeyGenerator(PersistenceFactory factory, Properties params, int sqlType) throws MappingException
factory
- The current PersistenceFactory
instance.params
- Parameters for the key generator.sqlType
- The SQL type of the identity field.MappingException
public Object generateKey(Connection connection, String tableName, String primKeyName) throws PersistenceException
KeyGenerator
connection
- An open connection within the given transactiontableName
- The table nameprimKeyName
- The primary key namePersistenceException
- An error occured talking to persistent
storagepublic boolean isInSameConnection()
KeyGenerator
public PersistenceFactory getFactory()
public JPATableGeneratorDescriptor getDescriptor()
Copyright © 2013. All rights reserved.