org.hibernate.id.enhanced
Class SequenceStyleGenerator
java.lang.Object
org.hibernate.id.enhanced.SequenceStyleGenerator
- All Implemented Interfaces:
- Configurable, IdentifierGenerator, PersistentIdentifierGenerator
public class SequenceStyleGenerator
- extends Object
- implements PersistentIdentifierGenerator, Configurable
Generates identifier values based on an sequence-style database structure.
Variations range from actually using a sequence to using a table to mimic
a sequence. These variations are encapsulated by the DatabaseStructure
interface internally.
General configuration parameters:
Configuration parameters used specifically when the underlying structure is a table:
- Author:
- Steve Ebersole
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SEQUENCE_PARAM
public static final String SEQUENCE_PARAM
- See Also:
- Constant Field Values
DEF_SEQUENCE_NAME
public static final String DEF_SEQUENCE_NAME
- See Also:
- Constant Field Values
INITIAL_PARAM
public static final String INITIAL_PARAM
- See Also:
- Constant Field Values
DEFAULT_INITIAL_VALUE
public static final int DEFAULT_INITIAL_VALUE
- See Also:
- Constant Field Values
INCREMENT_PARAM
public static final String INCREMENT_PARAM
- See Also:
- Constant Field Values
DEFAULT_INCREMENT_SIZE
public static final int DEFAULT_INCREMENT_SIZE
- See Also:
- Constant Field Values
OPT_PARAM
public static final String OPT_PARAM
- See Also:
- Constant Field Values
FORCE_TBL_PARAM
public static final String FORCE_TBL_PARAM
- See Also:
- Constant Field Values
VALUE_COLUMN_PARAM
public static final String VALUE_COLUMN_PARAM
- See Also:
- Constant Field Values
DEF_VALUE_COLUMN
public static final String DEF_VALUE_COLUMN
- See Also:
- Constant Field Values
SequenceStyleGenerator
public SequenceStyleGenerator()
getDatabaseStructure
public DatabaseStructure getDatabaseStructure()
getOptimizer
public Optimizer getOptimizer()
getIdentifierType
public Type getIdentifierType()
configure
public void configure(Type type,
Properties params,
Dialect dialect)
throws MappingException
- Description copied from interface:
Configurable
- Configure this instance, given the value of parameters
specified by the user as <param> elements.
This method is called just once, following instantiation.
- Specified by:
configure
in interface Configurable
params
- param values, keyed by parameter name
- Throws:
MappingException
generate
public Serializable generate(SessionImplementor session,
Object object)
throws HibernateException
- Description copied from interface:
IdentifierGenerator
- Generate a new identifier.
- Specified by:
generate
in interface IdentifierGenerator
object
- the entity or toplevel collection for which the id is being generated
- Returns:
- a new identifier
- Throws:
HibernateException
generatorKey
public Object generatorKey()
- Description copied from interface:
PersistentIdentifierGenerator
- Return a key unique to the underlying database objects. Prevents us from
trying to create/remove them multiple times.
- Specified by:
generatorKey
in interface PersistentIdentifierGenerator
- Returns:
- Object an identifying key for this generator
sqlCreateStrings
public String[] sqlCreateStrings(Dialect dialect)
throws HibernateException
- Description copied from interface:
PersistentIdentifierGenerator
- The SQL required to create the underlying database objects.
- Specified by:
sqlCreateStrings
in interface PersistentIdentifierGenerator
- Returns:
- String[]
- Throws:
HibernateException
sqlDropStrings
public String[] sqlDropStrings(Dialect dialect)
throws HibernateException
- Description copied from interface:
PersistentIdentifierGenerator
- The SQL required to remove the underlying database objects.
- Specified by:
sqlDropStrings
in interface PersistentIdentifierGenerator
- Returns:
- String
- Throws:
HibernateException