public final class IdentityKeyGenerator extends java.lang.Object implements KeyGenerator
IdentityKeyGeneratorFactory| Modifier and Type | Field and Description |
|---|---|
(package private) java.lang.String |
fName |
AFTER_INSERT, BEFORE_INSERT, DURING_INSERT| Constructor and Description |
|---|
IdentityKeyGenerator(PersistenceFactory factory,
int sqlType)
Initialize the IDENTITY key generator.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
generateKey(java.sql.Connection conn,
java.lang.String tableName,
java.lang.String primKeyName,
java.util.Properties props)
Generate a new key for the specified table.
|
byte |
getStyle()
Style of key generator: BEFORE_INSERT, DURING_INSERT or AFTER_INSERT ?
|
boolean |
isInSameConnection()
Is key generated in the same connection as INSERT?
|
java.lang.String |
patchSQL(java.lang.String insert,
java.lang.String primKeyName)
Gives a possibility to patch the Castor-generated SQL statement
for INSERT (makes sense for DURING_INSERT key generators)
|
void |
supportsSqlType(int sqlType)
Determine if the key generator supports a given sql type.
|
public IdentityKeyGenerator(PersistenceFactory factory, int sqlType) throws MappingException
factory - A PersistenceFactory instance.sqlType - A SQLTypidentifier.MappingException - if this key generator is not compatible with the persistance factory.public void supportsSqlType(int sqlType)
throws MappingException
supportsSqlType in interface KeyGeneratorsqlType - MappingExceptionpublic java.lang.Object generateKey(java.sql.Connection conn,
java.lang.String tableName,
java.lang.String primKeyName,
java.util.Properties props)
throws PersistenceException
KeyGeneratorgenerateKey in interface KeyGeneratorconn - An open connection within the given transactiontableName - The table nameprimKeyName - The primary key nameprops - A temporary replacement for Principal objectPersistenceException - An error occured talking to persistent
storagepublic final byte getStyle()
getStyle in interface KeyGeneratorpublic boolean isInSameConnection()
isInSameConnection in interface KeyGeneratorpublic final java.lang.String patchSQL(java.lang.String insert,
java.lang.String primKeyName)
throws MappingException
patchSQL in interface KeyGeneratorinsert - Castor-generated INSERT statementprimKeyName - The primary key nameMappingExceptionIntalio Inc. (C) 1999-2006. All rights reserved http://www.intalio.com