Top Description Fields Constructors Methods
org.hibernate.id

public Class UUIDGenerator

extends Object
implements IdentifierGenerator, Configurable
Class Inheritance
All Implemented Interfaces
org.hibernate.id.Configurable, org.hibernate.id.IdentifierGenerator
Imports
java.io.Serializable, java.util.Properties, .UUID, org.slf4j.Logger, .LoggerFactory, org.hibernate.HibernateException, .MappingException, org.hibernate.dialect.Dialect, org.hibernate.engine.SessionImplementor, org.hibernate.id.uuid.StandardRandomStrategy, org.hibernate.type.Type, org.hibernate.type.descriptor.java.UUIDTypeDescriptor, org.hibernate.util.ReflectHelper

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:

Currently there are 2 standard implementations of UUIDGenerationStrategy:

Author
Steve Ebersole

Field Summary

Modifier and TypeField and Description
private static final Logger
private UUIDGenerationStrategy
public static final String
public static final String
private UUIDTypeDescriptor.ValueTransformer

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static UUIDGenerator
public void
configure(Type type, Properties
param values, keyed by parameter name
params
,
Dialect d)

Implements org.hibernate.id.Configurable.configure.

Configure this instance, given the value of parameters specified by the user as <param> elements.
public Serializable
generate(SessionImplementor session, Object
the entity or toplevel collection for which the id is being generated
object
)

Implements org.hibernate.id.IdentifierGenerator.generate.

Generate a new identifier.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

logback to summary
private static final Logger log
strategyback to summary
private UUIDGenerationStrategy strategy
UUID_GEN_STRATEGYback to summary
public static final String UUID_GEN_STRATEGY
UUID_GEN_STRATEGY_CLASSback to summary
public static final String UUID_GEN_STRATEGY_CLASS
valueTransformerback to summary
private UUIDTypeDescriptor.ValueTransformer valueTransformer

Constructor Detail

UUIDGeneratorback to summary
public UUIDGenerator()

Method Detail

buildSessionFactoryUniqueIdentifierGeneratorback to summary
public static UUIDGenerator buildSessionFactoryUniqueIdentifierGenerator()
configureback to summary
public void configure(Type type, Properties params, Dialect d) throws MappingException

Implements org.hibernate.id.Configurable.configure.

Doc from org.hibernate.id.Configurable.configure.

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:Properties

param values, keyed by parameter name

generateback to summary
public Serializable generate(SessionImplementor session, Object object) throws HibernateException

Implements org.hibernate.id.IdentifierGenerator.generate.

Doc from org.hibernate.id.IdentifierGenerator.generate.

Generate a new identifier.

Parameters
object:Object

the entity or toplevel collection for which the id is being generated

Returns:Serializable

a new identifier