public class TableIdGenerator extends IdGenerator
TableGenerator.
 The content of the value column is interpreted like nextValue of a sequence, which means the maximum allocated
 value is allways at most value column value - allocationSize.| Modifier and Type | Field and Description | 
|---|---|
| private int | allocationSize | 
| private GeneratorDialect | dialect | 
| private GeneratorTable | generatorTable | 
| private long | initialValue | 
| private long | maxAllocatedValueThe maximum allocated value. | 
| private long | nextValue | 
| private GeneratorColumn | pkColumn | 
| private ColumnExpression | pkColumnValue | 
| private boolean | relativeIds | 
| private GeneratorColumn | valueColumn | 
| Modifier | Constructor and Description | 
|---|---|
| private  | TableIdGenerator(GeneratorDialect dialect,
                boolean relativeIds,
                GeneratorTable generatorTable,
                GeneratorColumn pkColumn,
                ColumnExpression pkColumnValue,
                GeneratorColumn valueColumn,
                int allocationSize,
                long initialValue,
                long nextValue,
                long maxAllocatedValue) | 
|   | TableIdGenerator(javax.persistence.TableGenerator generator,
                GeneratorContext context)Creates a new instance of  SequenceIdGenerator. | 
| Modifier and Type | Method and Description | 
|---|---|
| void | addNextValue(TableStatement statement,
            GeneratorColumn column,
            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. | 
| void | createPreInsertStatements(StatementsWriter writer)Creates the statements that are needed in the output before
  IdGenerator.addNextValue(TableStatement, GeneratorColumn, Number). | 
| IdGenerator | derive(GeneratorTable currentTable)Some implementations (like the Hibernate table generator) create a different generator, depending on the table
 name. | 
| int | getAllocationSize() | 
| long | getCurrentValue()The last value returned by  IdGenerator.createNextValue(Class). | 
| GeneratorDialect | getDialect() | 
| ColumnExpression | getExpression(GeneratorTable table,
             GeneratorColumn column,
             Number targetId,
             boolean whereExpression)Builds the reference to another entity that has the given ID. | 
| GeneratorTable | getGeneratorTable() | 
| long | getInitialValue() | 
| long | getMaxAllocatedValue()The maximum allocated value. | 
| long | getNextValue() | 
| GeneratorColumn | getPkColumn() | 
| ColumnExpression | getPkColumnValue() | 
| GeneratorColumn | getValueColumn() | 
| private long | getValueColumnValue() | 
| boolean | isPostIncrement()Indicates that  IdGenerator.createNextValue(Class)should be called after the entity was written - as the value is
 not available before. | 
| boolean | isRelativeIds() | 
| void | setCurrentValue(long currentValue)Sets a new start value. | 
createNextValueprivate final GeneratorDialect dialect
private final boolean relativeIds
private final GeneratorTable generatorTable
private final GeneratorColumn pkColumn
private final ColumnExpression pkColumnValue
private final GeneratorColumn valueColumn
private final int allocationSize
private long initialValue
private long nextValue
private long maxAllocatedValue
allocationSize greater.public TableIdGenerator(javax.persistence.TableGenerator generator,
                        GeneratorContext context)
SequenceIdGenerator.generator - the annotation that contains our settingscontext - the current context@Generated(value="lombok") private TableIdGenerator(GeneratorDialect dialect, boolean relativeIds, GeneratorTable generatorTable, GeneratorColumn pkColumn, ColumnExpression pkColumnValue, GeneratorColumn valueColumn, int allocationSize, long initialValue, long nextValue, long maxAllocatedValue)
public void addNextValue(TableStatement statement, GeneratorColumn column, Number value)
IdGeneratoraddNextValue in class IdGeneratorstatement - the current insert statementcolumn - 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 void createPreInsertStatements(StatementsWriter writer) throws IOException
IdGeneratorIdGenerator.addNextValue(TableStatement, GeneratorColumn, Number).createPreInsertStatements in class IdGeneratorwriter - target for the created statementsIOException - if the writer throws onepublic IdGenerator derive(GeneratorTable currentTable)
IdGeneratorderive in class IdGeneratorcurrentTable - the current entity tablepublic long getCurrentValue()
IdGeneratorIdGenerator.createNextValue(Class).getCurrentValue in class IdGeneratorpublic ColumnExpression getExpression(GeneratorTable table, GeneratorColumn column, Number targetId, boolean whereExpression)
IdGeneratorgetExpression in class IdGeneratortable - the main 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 situationprivate long getValueColumnValue()
public 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 database@Generated(value="lombok") public GeneratorDialect getDialect()
@Generated(value="lombok") public boolean isRelativeIds()
@Generated(value="lombok") public GeneratorTable getGeneratorTable()
@Generated(value="lombok") public GeneratorColumn getPkColumn()
@Generated(value="lombok") public ColumnExpression getPkColumnValue()
@Generated(value="lombok") public GeneratorColumn getValueColumn()
@Generated(value="lombok") public int getAllocationSize()
@Generated(value="lombok") public long getInitialValue()
@Generated(value="lombok") public long getNextValue()
@Generated(value="lombok") public long getMaxAllocatedValue()
allocationSize greater.Copyright © 2022 fastnate.org. All rights reserved.