public class UUIDGenerator extends Object implements IdentifierGenerator, Configurable
An IdentifierGenerator which generates UUID values using a pluggable
generation strategy. The values this generator can return
include UUID, String and byte[16]
<p/>
Supports 2 config parameters:<ul>
<li>UUID_GEN_STRATEGY - names the UUIDGenerationStrategy instance to use</li>
<li>UUID_GEN_STRATEGY_CLASS - names the UUIDGenerationStrategy class to use</li>
</ul>
<p/>
Currently there are 2 standard implementations of UUIDGenerationStrategy:<ul>
<li>StandardRandomStrategy (the default, if none specified)</li>
<li>CustomVersionOneStrategy</li>
</ul>
| Modifier and Type | Field and Description |
|---|---|
static String |
UUID_GEN_STRATEGY |
static String |
UUID_GEN_STRATEGY_CLASS |
ENTITY_NAME, GENERATOR_NAME, JPA_ENTITY_NAME| Constructor and Description |
|---|
UUIDGenerator() |
| Modifier and Type | Method and Description |
|---|---|
static UUIDGenerator |
buildSessionFactoryUniqueIdentifierGenerator() |
void |
configure(Type type,
Properties params,
ServiceRegistry serviceRegistry)
Configure this instance, given the value of parameters
specified by the user as <tt><param></tt> elements.
|
Serializable |
generate(SharedSessionContractImplementor session,
Object object)
Generate a new identifier.
|
public static final String UUID_GEN_STRATEGY
public static final String UUID_GEN_STRATEGY_CLASS
public static UUIDGenerator buildSessionFactoryUniqueIdentifierGenerator()
public void configure(Type type, Properties params, ServiceRegistry serviceRegistry) throws MappingException
ConfigurableConfigure this instance, given the value of parameters specified by the user as <tt><param></tt> elements. This method is called just once, following instantiation.
configure in interface Configurabletype - The id property type descriptorparams - param values, keyed by parameter nameserviceRegistry - Access to service that may be needed.MappingExceptionpublic Serializable generate(SharedSessionContractImplementor session, Object object) throws HibernateException
IdentifierGeneratorGenerate a new identifier.
generate in interface IdentifierGeneratorsession - The session from which the request originatesobject - the entity or collection (idbag) for which the id is being generatedHibernateException - Indicates trouble generating the identifierCopyright © 2001-2018 Red Hat, Inc. All Rights Reserved.