Package org.hibernate.id
Class UUIDGenerator
java.lang.Object
org.hibernate.id.UUIDGenerator
- All Implemented Interfaces:
Configurable,IdentifierGenerator
An
IdentifierGenerator which generates UUID values using a pluggable
generation strategy. The values this generator can return
include UUID, String and byte[16]
Supports 2 config parameters:UUID_GEN_STRATEGY- names theUUIDGenerationStrategyinstance to useUUID_GEN_STRATEGY_CLASS- names theUUIDGenerationStrategyclass to use
UUIDGenerationStrategy:StandardRandomStrategy(the default, if none specified)CustomVersionOneStrategy
-
Field Summary
FieldsFields inherited from interface org.hibernate.id.IdentifierGenerator
ENTITY_NAME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic UUIDGeneratorvoidconfigure(Type type, Properties params, Dialect d) Configure this instance, given the value of parameters specified by the user as <param> elements.generate(SessionImplementor session, Object object) Generate a new identifier.
-
Field Details
-
UUID_GEN_STRATEGY
- See Also:
-
UUID_GEN_STRATEGY_CLASS
- See Also:
-
-
Constructor Details
-
UUIDGenerator
public UUIDGenerator()
-
-
Method Details
-
buildSessionFactoryUniqueIdentifierGenerator
-
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-object- the entity or toplevel collection for which the id is being generated- Returns:
- a new identifier
- Throws:
HibernateException
-