public final class SequenceAfterKeyGenerator extends AbstractAfterKeyGenerator
Constructor and Description |
---|
SequenceAfterKeyGenerator(PersistenceFactory factory,
Properties params,
int sqlType)
Initialize the SEQUENCE key generator for AFTER_INSERT style
generateKey(java.sql.Connection, java.lang.String, java.lang.String) is called after INSERT. |
Modifier and Type | Method and Description |
---|---|
Object |
generateKey(Connection conn,
String tableName,
String primKeyName)
Generate a new key for the specified table.
|
protected void |
initSqlTypeHandler(int sqlType)
Initialize the Handler based on SQL Type.
|
boolean |
isInSameConnection()
Is key generated in the same connection as INSERT?
For DURING_INSERT style this method is never called.
|
buildStatement, executeStatement
closeSeparateConnection, getSeparateConnection
public SequenceAfterKeyGenerator(PersistenceFactory factory, Properties params, int sqlType) throws MappingException
generateKey(java.sql.Connection, java.lang.String, java.lang.String)
is called after INSERT.factory
- A PersistenceFactory instance.params
- Database engine specific parameters.sqlType
- A SQLTypidentifier.MappingException
- if this key generator is not compatible with the
persistance factory.protected void initSqlTypeHandler(int sqlType)
sqlType
- A SQLTypidentifier.public Object generateKey(Connection conn, String tableName, String primKeyName) throws PersistenceException
KeyGenerator
conn
- An open connection within the given transaction.tableName
- The table name.primKeyName
- The primary key name.PersistenceException
- An error occured talking to persistent storage.public boolean isInSameConnection()
Copyright © 2018. All rights reserved.