Top Description Fields Constructors Methods
org.hibernate.id

public Class UUIDGenerator

extends Object
implements IdentifierGenerator, StandardGenerator
Class Inheritance
All Implemented Interfaces
org.hibernate.id.factory.spi.StandardGenerator, org.hibernate.id.IdentifierGenerator, org.hibernate.id.Configurable, org.hibernate.boot.model.relational.ExportableProducer, org.hibernate.generator.BeforeExecutionGenerator, org.hibernate.generator.Generator, java.io.Serializable
Annotations
@Deprecated
since:6.0
Imports
java.util.Properties, .UUID, org.hibernate.HibernateException, .MappingException, org.hibernate.boot.registry.classloading.spi.ClassLoaderService, .ClassLoadingException, org.hibernate.engine.spi.SharedSessionContractImplementor, org.hibernate.id.factory.spi.StandardGenerator, org.hibernate.id.uuid.StandardRandomStrategy, org.hibernate.internal.CoreLogging, .CoreMessageLogger, org.hibernate.service.ServiceRegistry, org.hibernate.type.Type, org.hibernate.type.descriptor.java.UUIDJavaType

Deprecated

since 6.0.

use org.hibernate.id.uuid.UuidGenerator and org.hibernate.annotations.UuidGenerator instead

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:

Field Summary

Modifier and TypeField and Description
private static final CoreMessageLogger
private UUIDGenerationStrategy
strategy

Deprecated as a consequence of UUIDGenerationStrategy being deprecated.
public static final String
public static final String
private UUIDJavaType.ValueTransformer

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
configure(Type
The id property type descriptor
type
,
Properties
param values, keyed by parameter name
parameters
,
ServiceRegistry
Access to service that may be needed.
serviceRegistry
)

Overrides default org.hibernate.id.IdentifierGenerator.configure.

Configure this instance, given the value of parameters specified by the user as <param> elements.
public Object
generate(SharedSessionContractImplementor
The session from which the request originates
session
,
Object
the entity or collection (idbag) 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 CoreMessageLogger LOG
strategyback to summary
private UUIDGenerationStrategy strategy

Deprecated

as a consequence of UUIDGenerationStrategy being deprecated. See corresponding docs for further information.

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 UUIDJavaType.ValueTransformer valueTransformer

Constructor Detail

UUIDGeneratorback to summary
public UUIDGenerator()

Method Detail

configureback to summary
public void configure(Type type, Properties parameters, ServiceRegistry serviceRegistry) throws MappingException

Overrides default org.hibernate.id.IdentifierGenerator.configure.

Doc from org.hibernate.id.IdentifierGenerator.configure.

Configure this instance, given the value of parameters specified by the user as <param> elements.

This method is called just once, following instantiation, and before registerExportables(Database).

Parameters
type:Type

The id property type descriptor

parameters:Properties

param values, keyed by parameter name

serviceRegistry:ServiceRegistry

Access to service that may be needed.

Annotations
@Override
generateback to summary
public Object generate(SharedSessionContractImplementor session, Object object) throws HibernateException

Implements org.hibernate.id.IdentifierGenerator.generate.

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

Generate a new identifier.

Parameters
session:SharedSessionContractImplementor

The session from which the request originates

object:Object

the entity or collection (idbag) for which the id is being generated

Returns:Object

a new identifier

Exceptions
HibernateException:
Indicates trouble generating the identifier