Top Description Inners Fields Constructors Methods
org.hibernate.id.enhanced

public Class LegacyHiLoAlgorithmOptimizer

extends AbstractOptimizer
Class Inheritance
Imports
java.io.Serializable, java.util.Map, java.util.concurrent.ConcurrentHashMap, org.hibernate.HibernateException, org.hibernate.id.IntegralDataTypeHolder, org.jboss.logging.Logger

Slight variation from HiLoOptimizer, maintaining compatibility with the values generated by the legacy Hibernate hilo based generators.
Author
Steve Ebersole

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final long
private static final Logger
private LegacyHiLoAlgorithmOptimizer.GenerationState
private Map<String, LegacyHiLoAlgorithmOptimizer.GenerationState>
Inherited from org.hibernate.id.enhanced.AbstractOptimizer:
incrementSizereturnClass

Constructor Summary

AccessConstructor and Description
public
LegacyHiLoAlgorithmOptimizer(Class<T>
The Java type of the values to be generated
returnClass
,
int
The increment size.
incrementSize
)

Constructs a LegacyHiLoAlgorithmOptimizer

Method Summary

Modifier and TypeMethod and Description
public boolean
applyIncrementSizeToSourceValues()

Implements org.hibernate.id.enhanced.Optimizer.applyIncrementSizeToSourceValues.

Are increments to be applied to the values stored in the underlying value source?
private LegacyHiLoAlgorithmOptimizer.GenerationState
public synchronized Serializable
generate(AccessCallback
Callback to access the underlying value source.
callback
)

Implements org.hibernate.id.enhanced.Optimizer.generate.

Generate an identifier value accounting for this specific optimization.
public synchronized IntegralDataTypeHolder
getLastSourceValue()

Implements org.hibernate.id.enhanced.Optimizer.getLastSourceValue.

A common means to access the last value obtained from the underlying source.
public synchronized IntegralDataTypeHolder

Returns:

Value for property 'lastValue'.
getLastValue
()

Getter for property 'lastValue'.

private LegacyHiLoAlgorithmOptimizer.GenerationState
locateGenerationState(String tenantIdentifier)

private LegacyHiLoAlgorithmOptimizer.GenerationState
Inherited from org.hibernate.id.enhanced.AbstractOptimizer:
getIncrementSizegetReturnClass

Field Detail

initialMaxLoback to summary
private final long initialMaxLo
logback to summary
private static final Logger log
noTenantStateback to summary
private LegacyHiLoAlgorithmOptimizer.GenerationState noTenantState
tenantSpecificStateback to summary
private Map<String, LegacyHiLoAlgorithmOptimizer.GenerationState> tenantSpecificState

Constructor Detail

LegacyHiLoAlgorithmOptimizerback to summary
public LegacyHiLoAlgorithmOptimizer(Class<T> returnClass, int incrementSize)

Constructs a LegacyHiLoAlgorithmOptimizer

Parameters
returnClass:Class<T>

The Java type of the values to be generated

incrementSize:int

The increment size.

Method Detail

applyIncrementSizeToSourceValuesback to summary
public boolean applyIncrementSizeToSourceValues()

Implements org.hibernate.id.enhanced.Optimizer.applyIncrementSizeToSourceValues.

Doc from org.hibernate.id.enhanced.Optimizer.applyIncrementSizeToSourceValues.

Are increments to be applied to the values stored in the underlying value source?

Returns:boolean

True if the values in the source are to be incremented according to the defined increment size; false otherwise, in which case the increment is totally an in memory construct.

Annotations
@Override
createGenerationStateback to summary
private LegacyHiLoAlgorithmOptimizer.GenerationState createGenerationState()
generateback to summary
public synchronized Serializable generate(AccessCallback callback)

Implements org.hibernate.id.enhanced.Optimizer.generate.

Doc from org.hibernate.id.enhanced.Optimizer.generate.

Generate an identifier value accounting for this specific optimization. All known implementors are synchronized. Consider carefully if a new implementation could drop this requirement.

Parameters
callback:AccessCallback

Callback to access the underlying value source.

Returns:Serializable

The generated identifier value.

Annotations
@Override
getLastSourceValueback to summary
public synchronized IntegralDataTypeHolder getLastSourceValue()

Implements org.hibernate.id.enhanced.Optimizer.getLastSourceValue.

Doc from org.hibernate.id.enhanced.Optimizer.getLastSourceValue.

A common means to access the last value obtained from the underlying source. This is intended for testing purposes, since accessing the underlying database source directly is much more difficult.

Returns:IntegralDataTypeHolder

The last value we obtained from the underlying source; null indicates we have not yet consulted with the source.

Annotations
@Override
getLastValueback to summary
public synchronized IntegralDataTypeHolder getLastValue()

Getter for property 'lastValue'.

Exposure intended for testing purposes.

Returns:IntegralDataTypeHolder

Value for property 'lastValue'.

Annotations
@SuppressWarnings:UnusedDeclaration
locateGenerationStateback to summary
private LegacyHiLoAlgorithmOptimizer.GenerationState locateGenerationState(String tenantIdentifier)
noTenantGenerationStateback to summary
private LegacyHiLoAlgorithmOptimizer.GenerationState noTenantGenerationState()
org.hibernate.id.enhanced back to summary

private Class LegacyHiLoAlgorithmOptimizer.GenerationState

extends Object
Class Inheritance
  • java.lang.Object
  • org.hibernate.id.enhanced.LegacyHiLoAlgorithmOptimizer.GenerationState

Field Summary

Modifier and TypeField and Description
private IntegralDataTypeHolder
private IntegralDataTypeHolder
private long
private long
private IntegralDataTypeHolder

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

hiback to summary
private IntegralDataTypeHolder hi
lastSourceValueback to summary
private IntegralDataTypeHolder lastSourceValue
loback to summary
private long lo
maxLoback to summary
private long maxLo
valueback to summary
private IntegralDataTypeHolder value

Constructor Detail

GenerationStateback to summary
private GenerationState()