public class IdentityValue extends IdGenerator
GenerationType.IDENTITY
.Constructor and Description |
---|
IdentityValue() |
Modifier and Type | Method and Description |
---|---|
void |
addNextValue(InsertStatement statement,
String column,
Number value)
Adds the generated value to the given statement.
|
List<? extends EntityStatement> |
alignNextValue()
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.
|
List<EntityStatement> |
createPreInsertStatements()
Creates the statements that are needed in the output before
IdGenerator.addNextValue(InsertStatement, String, Number) . |
String |
getExpression(String table,
String column,
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. |
createNextValue, derive, getCurrentValue
public void addNextValue(InsertStatement statement, String column, Number value)
IdGenerator
addNextValue
in class IdGenerator
statement
- the current insert statementcolumn
- the name of the ID columnvalue
- the current value of the column, previously generated with IdGenerator.createNextValue()
public List<? extends EntityStatement> alignNextValue()
IdGenerator
currentValue + 1
.alignNextValue
in class IdGenerator
public long createNextValue()
IdGenerator
createNextValue
in class IdGenerator
public List<EntityStatement> createPreInsertStatements()
IdGenerator
IdGenerator.addNextValue(InsertStatement, String, Number)
.createPreInsertStatements
in class IdGenerator
public String getExpression(String table, String column, Number targetId, boolean whereExpression)
IdGenerator
getExpression
in class IdGenerator
table
- the name of the table of the entitycolumn
- 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()
IdGenerator
IdGenerator.createNextValue(Class)
should be called after the entity was written - as the value is
not available before.isPostIncrement
in class IdGenerator
true
if the database increments the value _after_ the insert statement was executed, true
if it is incremented before or during the executionCopyright © 2016 fastnate.org. All rights reserved.