public interface IdGenerator
Either generatePreInsert(IdGenerationConfig) or generatePostInsert(IdGenerationConfig, Statement) must return non-null value.
The implementation class must have a public no-args constructor.
The implementation class must be thread safe.
| Modifier and Type | Method and Description |
|---|---|
java.lang.Long |
generatePostInsert(IdGenerationConfig config,
java.sql.Statement statement)
Generates the identity value after an insert.
|
java.lang.Long |
generatePreInsert(IdGenerationConfig config)
Generates the identity value before an insert.
|
GenerationType |
getGenerationType()
Returns the generation type.
|
boolean |
includesIdentityColumn(IdGenerationConfig config)
Whether this generator includes the identity column into SQL INSERT statements.
|
boolean |
supportsAutoGeneratedKeys(IdGenerationConfig config)
Whether this generator supports
Statement.getGeneratedKeys(). |
boolean |
supportsBatch(IdGenerationConfig config)
Whether this generator supports the batch insert.
|
boolean supportsBatch(IdGenerationConfig config)
config - the configurationtrue if this generator supportsboolean supportsAutoGeneratedKeys(IdGenerationConfig config)
Statement.getGeneratedKeys().config - the configurationtrue if this generator supportsboolean includesIdentityColumn(IdGenerationConfig config)
config - the configurationtrue if supportedjava.lang.Long generatePreInsert(IdGenerationConfig config)
config - the configurationnull if not supportedJdbcException - if the generation is failedjava.lang.Long generatePostInsert(IdGenerationConfig config, java.sql.Statement statement)
config - the configurationstatement - the SQL INSERT statementnull if not supportedJdbcException - if the generation is failedGenerationType getGenerationType()