public final class MaxKeyGenerator extends java.lang.Object implements KeyGenerator
MaxKeyGeneratorFactoryAFTER_INSERT, BEFORE_INSERT, DURING_INSERT| Constructor and Description |
|---|
MaxKeyGenerator(PersistenceFactory factory,
int sqlType)
Initialize the MAX 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 as "MAX(primary_key) + 1".
|
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 MaxKeyGenerator(PersistenceFactory factory, int sqlType) throws MappingException
MappingExceptionpublic 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
generateKey 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 final java.lang.String patchSQL(java.lang.String insert,
java.lang.String primKeyName)
patchSQL in interface KeyGeneratorinsert - Castor-generated INSERT statementprimKeyName - The primary key namepublic boolean isInSameConnection()
isInSameConnection in interface KeyGeneratorIntalio Inc. (C) 1999-2006. All rights reserved http://www.intalio.com