public class

SequenceGenerator

extends Object
implements Configurable PersistentIdentifierGenerator
java.lang.Object
   ↳ org.hibernate.id.SequenceGenerator
Known Direct Subclasses

Class Overview

sequence

Generates long values using an oracle-style sequence. A higher performance algorithm is SequenceHiLoGenerator.

Mapping parameters supported: sequence, parameters.

Summary

Constants
String PARAMETERS The parameters parameter, appended to the create sequence DDL.
String SEQUENCE The sequence parameter
[Expand]
Inherited Constants
From interface org.hibernate.id.IdentifierGenerator
From interface org.hibernate.id.PersistentIdentifierGenerator
[Expand]
Inherited Fields
From interface org.hibernate.id.PersistentIdentifierGenerator
Public Constructors
SequenceGenerator()
Public Methods
void configure(Type type, Properties params, Dialect dialect)
Configure this instance, given the value of parameters specified by the user as <param> elements.
Serializable generate(SessionImplementor session, Object obj)
Generate a new identifier.
Object generatorKey()
Return a key unique to the underlying database objects.
String getSequenceName()
String[] 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.
Protected Methods
IntegralDataTypeHolder buildHolder()
IntegralDataTypeHolder generateHolder(SessionImplementor session)
Type getIdentifierType()
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.hibernate.id.Configurable
From interface org.hibernate.id.IdentifierGenerator
From interface org.hibernate.id.PersistentIdentifierGenerator

Constants

public static final String PARAMETERS

The parameters parameter, appended to the create sequence DDL. For example (Oracle): INCREMENT BY 1 START WITH 1 MAXVALUE 100 NOCACHE.

Constant Value: "parameters"

public static final String SEQUENCE

The sequence parameter

Constant Value: "sequence"

Public Constructors

public SequenceGenerator ()

Public Methods

public void configure (Type type, Properties params, Dialect dialect)

Configure this instance, given the value of parameters specified by the user as <param> elements. This method is called just once, following instantiation.

Parameters
params param values, keyed by parameter name

public Serializable generate (SessionImplementor session, Object obj)

Generate a new identifier.

Parameters
obj the entity or toplevel collection for which the id is being generated
Returns
  • a new identifier

public Object generatorKey ()

Return a key unique to the underlying database objects. Prevents us from trying to create/remove them multiple times.

Returns
  • Object an identifying key for this generator

public String getSequenceName ()

public String[] sqlCreateStrings (Dialect dialect)

The SQL required to create the underlying database objects.

Parameters
dialect The dialect against which to generate the create command(s)
Returns
  • The create command(s)

public String[] sqlDropStrings (Dialect dialect)

The SQL required to remove the underlying database objects.

Parameters
dialect The dialect against which to generate the drop command(s)
Returns
  • The drop command(s)

Protected Methods

protected IntegralDataTypeHolder buildHolder ()

protected IntegralDataTypeHolder generateHolder (SessionImplementor session)

protected Type getIdentifierType ()