Package org.hibernate.id.uuid
Class UuidGenerator
- java.lang.Object
-
- org.hibernate.id.uuid.UuidGenerator
-
- All Implemented Interfaces:
Serializable
,BeforeExecutionGenerator
,Generator
public class UuidGenerator extends Object implements BeforeExecutionGenerator
Generator for producingUUID
values. Uses a UuidValueGenerator and UUIDJavaType.ValueTransformer to generate the values.- See Also:
UuidGenerator
, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description UuidGenerator(Class<?> memberType)
This form is used when there is no@UuidGenerator
but we know we want this generatorUuidGenerator(UuidGenerator config, Member member, GeneratorCreationContext creationContext)
UuidGenerator(UuidGenerator config, Member idMember, CustomIdGeneratorCreationContext creationContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
generate(SharedSessionContractImplementor session, Object owner, Object currentValue, EventType eventType)
Generate a value.EnumSet<EventType>
getEventTypes()
The event types for which this generator should be called to produce a new value.UuidValueGenerator
getValueGenerator()
UUIDJavaType.ValueTransformer
getValueTransformer()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.hibernate.generator.BeforeExecutionGenerator
generatedOnExecution
-
Methods inherited from interface org.hibernate.generator.Generator
allowAssignedIdentifiers, generatedOnExecution, generatesOnInsert, generatesOnUpdate, generatesSometimes
-
-
-
-
Constructor Detail
-
UuidGenerator
@Internal public UuidGenerator(Class<?> memberType)
This form is used when there is no@UuidGenerator
but we know we want this generator
-
UuidGenerator
public UuidGenerator(UuidGenerator config, Member idMember, CustomIdGeneratorCreationContext creationContext)
-
UuidGenerator
public UuidGenerator(UuidGenerator config, Member member, GeneratorCreationContext creationContext)
-
-
Method Detail
-
getEventTypes
public EnumSet<EventType> getEventTypes()
Description copied from interface:Generator
The event types for which this generator should be called to produce a new value.Identifier generators must return
EventTypeSets.INSERT_ONLY
.- Specified by:
getEventTypes
in interfaceGenerator
- Returns:
EventTypeSets.INSERT_ONLY
-
generate
public Object generate(SharedSessionContractImplementor session, Object owner, Object currentValue, EventType eventType)
Description copied from interface:BeforeExecutionGenerator
Generate a value.- Specified by:
generate
in interfaceBeforeExecutionGenerator
- Parameters:
session
- The session from which the request originates.owner
- The instance of the object owning the attribute for which we are generating a value.currentValue
- The current value assigned to the property, ornull
eventType
- The type of event that has triggered generation of a new value- Returns:
- The generated value
-
getValueGenerator
@Internal public UuidValueGenerator getValueGenerator()
-
getValueTransformer
@Internal public UUIDJavaType.ValueTransformer getValueTransformer()
-
-