IdentifierGenerator that returns a long, constructed by counting
from the maximum primary key value obtained by querying the table or tables at startup.
This id generator is not safe unless a single VM has exclusive access to the database.
Mapping parameters supported, but not usually needed: tables, column. (The tables parameter specifies a comma-separated list of table names.)
Implementation Note
This also implements the increment generation type in hbm.xml mappings.
| Modifier and Type | Field and Description |
|---|---|
| public static final String | COLUMN
A parameter identifying the column holding the id. |
| private String | |
| private static final CoreMessageLogger | |
| private List | |
| private IntegralDataTypeHolder | |
| private Class | |
| private String | |
| public static final String | TABLES
A parameter specifying a list of tables over which the generated id should be unique. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | configure(Type
The id property type descriptor type, Properties param values, keyed by parameter name parameters, ServiceRegistry Access to service that may be needed. serviceRegistry)Overrides default org. <param> elements.
|
| public synchronized Object | generate(SharedSessionContractImplementor
The session from which the request originates session, Object the entity or collection (idbag) for which the id is being generated object)Implements org. |
| public String[] | |
| public void | initialize(SqlStringGenerationContext
A context to help generate SQL strings context)Overrides default org. |
| private void |
| COLUMN | back to summary |
|---|---|
| public static final String COLUMN A parameter identifying the column holding the id. | |
| column | back to summary |
|---|---|
| private String column | |
| LOG | back to summary |
|---|---|
| private static final CoreMessageLogger LOG | |
| physicalTableNames | back to summary |
|---|---|
| private List<QualifiedTableName> physicalTableNames | |
| previousValueHolder | back to summary |
|---|---|
| private IntegralDataTypeHolder previousValueHolder | |
| returnClass | back to summary |
|---|---|
| private Class<?> returnClass | |
| sql | back to summary |
|---|---|
| private String sql | |
| TABLES | back to summary |
|---|---|
| public static final String TABLES A parameter specifying a list of tables over which the generated id should be unique. | |
| IncrementGenerator | back to summary |
|---|---|
| public IncrementGenerator() | |
| configure | back to summary |
|---|---|
| public void configure(Type type, Properties parameters, ServiceRegistry serviceRegistry) throws MappingException Overrides default org. Doc from org. Configure this instance, given the value of parameters
specified by the user as
This method is called just once, following instantiation,
and before
| |
| generate | back to summary |
|---|---|
| public synchronized Object generate(SharedSessionContractImplementor session, Object object) throws HibernateException Implements org. Doc from org. Generate a new identifier.
| |
| getAllSqlForTests | back to summary |
|---|---|
| public String[] getAllSqlForTests()
Deprecated Exposed for tests only.
| |
| initialize | back to summary |
|---|---|
| public void initialize(SqlStringGenerationContext context) Overrides default org. Doc from org. Initializes this instance, in particular pre-generates SQL as necessary.
This method is called after
| |
| initializePreviousValueHolder | back to summary |
|---|---|
| private void initializePreviousValueHolder(SharedSessionContractImplementor session) | |