Package org.hibernate.id
Class SequenceGenerator
java.lang.Object
org.hibernate.id.SequenceGenerator
- All Implemented Interfaces:
Configurable,IdentifierGenerator,PersistentIdentifierGenerator
- Direct Known Subclasses:
SequenceHiLoGenerator,SequenceIdentityGenerator
public class SequenceGenerator
extends Object
implements PersistentIdentifierGenerator, Configurable
sequence
Generates long values using an oracle-style sequence. A higher performance algorithm is SequenceHiLoGenerator.
Mapping parameters supported: sequence, parameters.
Generates long values using an oracle-style sequence. A higher performance algorithm is SequenceHiLoGenerator.
Mapping parameters supported: sequence, parameters.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe parameters parameter, appended to the create sequence DDL.static final StringThe sequence parameterFields inherited from interface org.hibernate.id.IdentifierGenerator
ENTITY_NAMEFields inherited from interface org.hibernate.id.PersistentIdentifierGenerator
CATALOG, IDENTIFIER_NORMALIZER, PK, SCHEMA, SQL_STATEMENT_LOGGER, TABLE, TABLES -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected IntegralDataTypeHoldervoidconfigure(Type type, Properties params, Dialect dialect) Configure this instance, given the value of parameters specified by the user as <param> elements.generate(SessionImplementor session, Object obj) Generate a new identifier.protected IntegralDataTypeHoldergenerateHolder(SessionImplementor session) Return a key unique to the underlying database objects.protected TypeString[]sqlCreateStrings(Dialect dialect) The SQL required to create the underlying database objects.String[]sqlDropStrings(Dialect dialect) The SQL required to remove the underlying database objects.
-
Field Details
-
SEQUENCE
The sequence parameter- See Also:
-
PARAMETERS
The parameters parameter, appended to the create sequence DDL. For example (Oracle): INCREMENT BY 1 START WITH 1 MAXVALUE 100 NOCACHE.- See Also:
-
-
Constructor Details
-
SequenceGenerator
public SequenceGenerator()
-
-
Method Details
-
getIdentifierType
-
configure
Description copied from interface:ConfigurableConfigure this instance, given the value of parameters specified by the user as <param> elements. This method is called just once, following instantiation.- Specified by:
configurein interfaceConfigurable- Parameters:
params- param values, keyed by parameter name- Throws:
MappingException
-
generate
Description copied from interface:IdentifierGeneratorGenerate a new identifier.- Specified by:
generatein interfaceIdentifierGenerator- Parameters:
session-obj- the entity or toplevel collection for which the id is being generated- Returns:
- a new identifier
-
generateHolder
-
buildHolder
-
sqlCreateStrings
Description copied from interface:PersistentIdentifierGeneratorThe SQL required to create the underlying database objects.- Specified by:
sqlCreateStringsin interfacePersistentIdentifierGenerator- Parameters:
dialect- The dialect against which to generate the create command(s)- Returns:
- The create command(s)
- Throws:
HibernateException- problem creating the create command(s)
-
sqlDropStrings
Description copied from interface:PersistentIdentifierGeneratorThe SQL required to remove the underlying database objects.- Specified by:
sqlDropStringsin interfacePersistentIdentifierGenerator- Parameters:
dialect- The dialect against which to generate the drop command(s)- Returns:
- The drop command(s)
- Throws:
HibernateException- problem creating the drop command(s)
-
generatorKey
Description copied from interface:PersistentIdentifierGeneratorReturn a key unique to the underlying database objects. Prevents us from trying to create/remove them multiple times.- Specified by:
generatorKeyin interfacePersistentIdentifierGenerator- Returns:
- Object an identifying key for this generator
-
getSequenceName
-