Package org.hibernate.id
package org.hibernate.id
This package and its subpackages, especially
org.hibernate.id.enhanced
,
contain the built-in id generators, all of which implement either
IdentifierGenerator
or
PostInsertIdentifierGenerator
.
The most useful id generators in modern Hibernate are:
IdentityGenerator
-@GeneratedValue(strategy=IDENTITY)
SequenceStyleGenerator
-@GeneratedValue(strategy=SEQUENCE)
TableGenerator
-@GeneratedValue(strategy=TABLE)
UuidGenerator
-@UuidGenerator
- See Also:
- API Note:
- The remaining id generators are kept around for backward compatibility
and as an implementation detail of the
hbm.xml
mapping format.
-
ClassDescriptionDeprecated, for removal: This API element is subject to removal in a future version.Deprecated.since
UUIDHexGenerator
is deprecatedAnIdentifierGenerator
that returns the current identifier assigned to an instance.Specialized contract forIdentifierGenerator
implementations capable of being used in conjunction with HQL insert statements.For composite identifiers, defines a number of "nested" generations that need to happen to "fill" the identifier property(s).Contract for declaring how to locate the context for sub-value injection.Contract for performing the actual sub-value generation, usually injecting it into the determined contextAGenerator
that supports "configuration".Describes the possible natures of an entity-defined identifier.Deprecated, for removal: This API element is subject to removal in a future version.This remains around as an implementation detail ofhbm.xml
mappings.Deprecated.useUuidGenerator
Thrown by anIdentifierGenerator
implementation class when ID generation fails.A classic extension point from the very earliest days of Hibernate, this interface is no longer the only way to generate identifiers.Identifies generators which potentially aggregate otherPersistentIdentifierGenerator
generators.Factory and helper methods forIdentifierGenerator
framework.AnOnExecutionGenerator
that handlesIDENTITY
/"autoincrement" columns on those databases which support them.AnIdentifierGenerator
that returns along
, constructed by counting from the maximum primary key value obtained by querying the table or tables at startup.Defines a common API for dealing with data of integral data type.Commonality between sequence-based and table-based generatorsAnIdentifierGenerator
that requires creation of database objects.The counterpart toIdentifierGenerator
for values generated by the database.Deprecated, for removal: This API element is subject to removal in a future version.UseEntityPersister
instead.Deprecated, for removal: This API element is subject to removal in a future version.this interface is unnecessary and no longer usedA generator thatselect
s the just-insert
ed row to determine the column value assigned by the database.Describes the strategy for handling the mismatch between a database sequence configuration and the one defined by the entity mapping.Deprecated.seeUUIDGenerator
Deprecated.useUuidGenerator
andUuidGenerator
insteadDeprecated.This remains around as an implementation detail ofhbm.xml
mappings.
PostInsertIdentifierGenerator
andBulkInsertionCapableIdentifierGenerator
, or even better, simply implementOnExecutionGenerator
directly.