Top Description Fields Constructors Methods
org.hibernate.generator.internal

public Class VersionGeneration

extends Object
implements BeforeExecutionGenerator
Class Inheritance
All Implemented Interfaces
org.hibernate.generator.BeforeExecutionGenerator, org.hibernate.generator.Generator, java.io.Serializable
Imports
org.hibernate.engine.spi.SharedSessionContractImplementor, org.hibernate.generator.EventType, .BeforeExecutionGenerator, org.hibernate.metamodel.mapping.EntityVersionMapping, java.util.EnumSet

A default org.hibernate.generator.Generator for @Version properties. This implementation simply delegates back to:

Thus, this implementation reproduces the "classic" behavior of Hibernate. A custom generator specified using a generator annotation will override this implementation, allowing customized versioning.

Author
Gavin King

Field Summary

Modifier and TypeField and Description
private final EntityVersionMapping

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Object
generate(SharedSessionContractImplementor
The session from which the request originates.
session
,
Object
The instance of the object owning the attribute for which we are generating a value.
owner
,
Object
The current value assigned to the property, or null
current
,
EventType
The type of event that has triggered generation of a new value
eventType
)

Implements org.hibernate.generator.BeforeExecutionGenerator.generate.

Generate a value.
public EnumSet<EventType>
getEventTypes()

Implements org.hibernate.generator.Generator.getEventTypes.

The event types for which this generator should be called to produce a new value.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

versionMappingback to summary
private final EntityVersionMapping versionMapping

Constructor Detail

VersionGenerationback to summary
public VersionGeneration(EntityVersionMapping versionMapping)

Method Detail

generateback to summary
public Object generate(SharedSessionContractImplementor session, Object owner, Object current, EventType eventType)

Implements org.hibernate.generator.BeforeExecutionGenerator.generate.

Doc from org.hibernate.generator.BeforeExecutionGenerator.generate.

Generate a value.

Parameters
session:SharedSessionContractImplementor

The session from which the request originates.

owner:Object

The instance of the object owning the attribute for which we are generating a value.

current:Object

The current value assigned to the property, or null

eventType:EventType

The type of event that has triggered generation of a new value

Returns:Object

The generated value

Annotations
@Override
getEventTypesback to summary
public EnumSet<EventType> getEventTypes()

Implements org.hibernate.generator.Generator.getEventTypes.

Doc from org.hibernate.generator.Generator.getEventTypes.

The event types for which this generator should be called to produce a new value.

Identifier generators must return EventTypeSets#INSERT_ONLY.

Returns:EnumSet<EventType>

a set of EventTypes.

Annotations
@Override