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

public Class TenantIdGeneration

extends Object
implements BeforeExecutionGenerator
Class Inheritance
All Implemented Interfaces
org.hibernate.generator.BeforeExecutionGenerator, org.hibernate.generator.Generator, java.io.Serializable
Imports
java.lang.reflect.Member, java.util.EnumSet, org.hibernate.PropertyValueException, org.hibernate.annotations.TenantId, org.hibernate.context.spi.CurrentTenantIdentifierResolver, org.hibernate.engine.spi.SessionFactoryImplementor, .SharedSessionContractImplementor, org.hibernate.generator.BeforeExecutionGenerator, .EventType, .EventTypeSets, .GeneratorCreationContext, org.hibernate.type.descriptor.java.JavaType

A generator that produces the current tenant identifier to be assigned to the TenantId property.
Author
Gavin King

Field Summary

Modifier and TypeField and Description
private final String
private final String

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
currentValue
,
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

entityNameback to summary
private final String entityName
propertyNameback to summary
private final String propertyName

Constructor Detail

TenantIdGenerationback to summary
public TenantIdGeneration(TenantId annotation, Member member, GeneratorCreationContext context)

Method Detail

generateback to summary
public Object generate(SharedSessionContractImplementor session, Object owner, Object currentValue, 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.

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

EventTypeSets#INSERT_ONLY

Annotations
@Override