Top Description Fields Constructors Methods
org.hibernate.id

public Class IncrementGenerator

extends Object
implements IdentifierGenerator
Class Inheritance
All Implemented Interfaces
org.hibernate.id.IdentifierGenerator, org.hibernate.boot.model.relational.ExportableProducer, org.hibernate.id.Configurable
Imports
java.io.Serializable, java.sql.PreparedStatement, .ResultSet, .SQLException, java.util.ArrayList, .List, .Properties, org.hibernate.HibernateException, .MappingException, org.hibernate.boot.model.naming.Identifier, .ObjectNameNormalizer, org.hibernate.boot.model.relational.QualifiedTableName, .SqlStringGenerationContext, org.hibernate.engine.jdbc.env.spi.IdentifierHelper, .JdbcEnvironment, org.hibernate.engine.spi.SharedSessionContractImplementor, org.hibernate.internal.CoreLogging, .CoreMessageLogger, org.hibernate.internal.util.StringHelper, org.hibernate.mapping.Table, org.hibernate.service.ServiceRegistry, org.hibernate.type.Type

Deprecated

as a consequence of IdentifierGenerator being deprecated. See corresponding docs for further information.

increment

An IdentifierGenerator that returns a long, constructed by counting from the maximum primary key value at startup. Not safe for use in a cluster!

Mapping parameters supported, but not usually needed: tables, column. (The tables parameter specified a comma-separated list of table names.)
Authors
Gavin King, Steve Ebersole, Brett Meyer

Field Summary

Modifier and TypeField and Description
private String
private static final CoreMessageLogger
private List<QualifiedTableName>
private IntegralDataTypeHolder
private Class<T>
private String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
configure(Type
The id property type descriptor
type
,
Properties
param values, keyed by parameter name
params
,
ServiceRegistry
Access to service that may be needed.
serviceRegistry
)

Overrides default org.hibernate.id.IdentifierGenerator.configure.

Configure this instance, given the value of parameters specified by the user as <param> elements.
public synchronized Serializable
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.hibernate.id.IdentifierGenerator.generate.

Generate a new identifier.
public String[]
getAllSqlForTests()

Deprecated Exposed for tests only.
public void
initialize(SqlStringGenerationContext
A context to help generate SQL strings
context
)

Overrides default org.hibernate.id.IdentifierGenerator.initialize.

Initializes this instance, in particular pre-generates SQL as necessary.
private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

columnback to summary
private String column
LOGback to summary
private static final CoreMessageLogger LOG
physicalTableNamesback to summary
private List<QualifiedTableName> physicalTableNames
previousValueHolderback to summary
private IntegralDataTypeHolder previousValueHolder
returnClassback to summary
private Class<T> returnClass
sqlback to summary
private String sql

Constructor Detail

IncrementGeneratorback to summary
public IncrementGenerator()

Method Detail

configureback to summary
public void configure(Type type, Properties params, ServiceRegistry serviceRegistry) throws MappingException

Overrides default org.hibernate.id.IdentifierGenerator.configure.

Doc from org.hibernate.id.IdentifierGenerator.configure.

Configure this instance, given the value of parameters specified by the user as <param> elements.

This method is called just once, following instantiation, and before registerExportables(Database).

Parameters
type:Type

The id property type descriptor

params:Properties

param values, keyed by parameter name

serviceRegistry:ServiceRegistry

Access to service that may be needed.

Annotations
@Override
Exceptions
MappingException:
If configuration fails.
generateback to summary
public synchronized Serializable generate(SharedSessionContractImplementor session, Object object) throws HibernateException

Implements org.hibernate.id.IdentifierGenerator.generate.

Doc from org.hibernate.id.IdentifierGenerator.generate.

Generate a new identifier.

Parameters
session:SharedSessionContractImplementor

The session from which the request originates

object:Object

the entity or collection (idbag) for which the id is being generated

Returns:Serializable

a new identifier

Annotations
@Override
Exceptions
HibernateException:
Indicates trouble generating the identifier
getAllSqlForTestsback to summary
public String[] getAllSqlForTests()

Deprecated

Exposed for tests only.

Annotations
@Deprecated
initializeback to summary
public void initialize(SqlStringGenerationContext context)

Overrides default org.hibernate.id.IdentifierGenerator.initialize.

Doc from org.hibernate.id.IdentifierGenerator.initialize.

Initializes this instance, in particular pre-generates SQL as necessary.

This method is called after registerExportables(Database), before first use.

Parameters
context:SqlStringGenerationContext

A context to help generate SQL strings

Annotations
@Override
initializePreviousValueHolderback to summary
private void initializePreviousValueHolder(SharedSessionContractImplementor session)