java.lang.Object
org.seasar.doma.jdbc.id.AbstractIdGenerator
org.seasar.doma.jdbc.id.AbstractPreGenerateIdGenerator
- All Implemented Interfaces:
IdGenerator
- Direct Known Subclasses:
BuiltinSequenceIdGenerator,BuiltinTableIdGenerator
A generator that generates an identity value before an execution of insert.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassA context for identity values. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected longprotected final ConcurrentMap<String,AbstractPreGenerateIdGenerator.IdContext> protected long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongeneratePostInsert(IdGenerationConfig config, Statement statement) Generates the identity value after an insert.generatePreInsert(IdGenerationConfig config) Generates the identity value before an insert.generateValuesPreInsert(IdGenerationConfig config, int count) protected AbstractPreGenerateIdGenerator.IdContextgetIdContext(IdGenerationConfig config) Returns the identity context.protected abstract longgetNewInitialValue(IdGenerationConfig config) Return the next initial value.booleanWhether this generator includes the identity column into SQL INSERT statements.booleanincludesIdentityColumn(IdGenerationConfig config, Object idValue) Determines whether the identity column is included in the SQL INSERT statements based on the given configuration and identity value.voidsetAllocationSize(long allocationSize) Sets the allocation size.voidsetInitialValue(long initialValue) Sets the initial value.booleanWhether this generator supportsStatement.getGeneratedKeys().booleansupportsBatch(IdGenerationConfig config) Whether this generator supports the batch insert.Methods inherited from class org.seasar.doma.jdbc.id.AbstractIdGenerator
getGeneratedValue, getGeneratedValue, setupOptionsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.seasar.doma.jdbc.id.IdGenerator
generateValuesPostInsert, getGenerationType
-
Field Details
-
initialValue
protected long initialValue -
allocationSize
protected long allocationSize -
idContextMap
-
-
Constructor Details
-
AbstractPreGenerateIdGenerator
public AbstractPreGenerateIdGenerator()
-
-
Method Details
-
setInitialValue
public void setInitialValue(long initialValue) Sets the initial value.- Parameters:
initialValue- the initial value
-
setAllocationSize
public void setAllocationSize(long allocationSize) Sets the allocation size.- Parameters:
allocationSize- the allocation size
-
supportsBatch
Description copied from interface:IdGeneratorWhether this generator supports the batch insert.- Parameters:
config- the configuration- Returns:
trueif this generator supports
-
supportsAutoGeneratedKeys
Description copied from interface:IdGeneratorWhether this generator supportsStatement.getGeneratedKeys().- Parameters:
config- the configuration- Returns:
trueif this generator supports
-
includesIdentityColumn
Description copied from interface:IdGeneratorWhether this generator includes the identity column into SQL INSERT statements.- Parameters:
config- the configuration- Returns:
trueif supported
-
includesIdentityColumn
Description copied from interface:IdGeneratorDetermines whether the identity column is included in the SQL INSERT statements based on the given configuration and identity value.The type of
idValuemust be one of the basic types. It must never be a domain class or an Optional type that wraps a basic type.- Parameters:
config- the configuration for identity generationidValue- an identity value; may be null- Returns:
trueif the identity column is included in the SQL INSERT statements, otherwisefalse
-
generatePreInsert
Description copied from interface:IdGeneratorGenerates the identity value before an insert.- Parameters:
config- the configuration- Returns:
- the generated value or
nullif not supported
-
generateValuesPreInsert
-
generatePostInsert
Description copied from interface:IdGeneratorGenerates the identity value after an insert.- Parameters:
config- the configurationstatement- the SQL INSERT statement- Returns:
- the generated value or
nullif not supported
-
getIdContext
Returns the identity context.- Parameters:
config- the configuration- Returns:
- the identity context
-
getNewInitialValue
Return the next initial value.- Parameters:
config- the configuration- Returns:
- the new initial value
- Throws:
JdbcException- if it fails to retrieve the next initial value.
-