public class IdentityValue extends IdGenerator
GenerationType.IDENTITY.| Modifier and Type | Field and Description |
|---|---|
private GeneratorColumn |
column |
private GeneratorContext |
context |
private long |
currentValue |
private boolean |
needsAlignment |
private GeneratorTable |
table |
| Constructor and Description |
|---|
IdentityValue(GeneratorContext context,
GeneratorTable table,
GeneratorColumn column) |
| Modifier and Type | Method and Description |
|---|---|
void |
addNextValue(TableStatement statement,
GeneratorColumn tableColumn,
Number value)
Adds the generated value to the given statement.
|
void |
alignNextValue(StatementsWriter writer)
Creates all statements that are necessary to set the next value created from the database is
currentValue + 1. |
long |
createNextValue()
Resolves the next value of this generator.
|
long |
getCurrentValue()
The last value returned by
IdGenerator.createNextValue(Class). |
ColumnExpression |
getExpression(GeneratorTable entityTable,
GeneratorColumn targetColumn,
Number targetId,
boolean whereExpression)
Builds the reference to another entity that has the given ID.
|
boolean |
isPostIncrement()
Indicates that
IdGenerator.createNextValue(Class) should be called after the entity was written - as the value is
not available before. |
void |
setCurrentValue(long currentValue)
Sets a new start value.
|
createNextValue, createPreInsertStatements, deriveprivate final GeneratorContext context
private final GeneratorTable table
private final GeneratorColumn column
private long currentValue
private boolean needsAlignment
public IdentityValue(GeneratorContext context, GeneratorTable table, GeneratorColumn column)
public void addNextValue(TableStatement statement, GeneratorColumn tableColumn, Number value)
IdGeneratoraddNextValue in class IdGeneratorstatement - the current insert statementtableColumn - the ID column of the current tablevalue - the current value of the column, previously generated with IdGenerator.createNextValue()public void alignNextValue(StatementsWriter writer) throws IOException
IdGeneratorcurrentValue + 1.alignNextValue in class IdGeneratorwriter - the target of the created statementsIOException - if the writer throws onepublic long createNextValue()
IdGeneratorcreateNextValue in class IdGeneratorpublic ColumnExpression getExpression(GeneratorTable entityTable, GeneratorColumn targetColumn, Number targetId, boolean whereExpression)
IdGeneratorgetExpression in class IdGeneratorentityTable - the main table of the entitytargetColumn - the name of the column of the IDtargetId - the current value of the IDwhereExpression - indicates if this expression is needed for a "SELECT ... WHERE ..." - some dialects behave differently
in this situationpublic boolean isPostIncrement()
IdGeneratorIdGenerator.createNextValue(Class) should be called after the entity was written - as the value is
not available before.isPostIncrement in class IdGeneratortrue if the database increments the value _after_ the insert statement was executed, true
if it is incremented before or during the executionpublic void setCurrentValue(long currentValue)
IdGeneratorsetCurrentValue in class IdGeneratorcurrentValue - the current value - most likely as extracted from the target databasepublic long getCurrentValue()
IdGeneratorIdGenerator.createNextValue(Class).getCurrentValue in class IdGeneratorCopyright © 2026 fastnate.org. All rights reserved.