Class AbstractNaturalIdLoader<T>
- java.lang.Object
-
- org.hibernate.loader.ast.internal.AbstractNaturalIdLoader<T>
-
- All Implemented Interfaces:
EntityLoader
,Loader
,MultiKeyLoader
,NaturalIdLoader<T>
- Direct Known Subclasses:
CompoundNaturalIdLoader
,SimpleNaturalIdLoader
public abstract class AbstractNaturalIdLoader<T> extends Object implements NaturalIdLoader<T>
Base support for NaturalIdLoader implementations
-
-
Constructor Summary
Constructors Constructor Description AbstractNaturalIdLoader(NaturalIdMapping naturalIdMapping, EntityMappingType entityDescriptor)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
applyNaturalIdRestriction(Object bindValue, TableGroup rootTableGroup, Consumer<Predicate> predicateConsumer, BiConsumer<JdbcParameter,JdbcParameterBinding> jdbcParameterConsumer, LoaderSqlAstCreationState sqlAstCreationState, SharedSessionContractImplementor session)
Apply restriction necessary to match the given natural-id value.protected EntityMappingType
entityDescriptor()
EntityMappingType
getLoadable()
The value-mapping loaded by this loaderT
load(Object naturalIdValue, NaturalIdLoadOptions options, SharedSessionContractImplementor session)
Perform the load of the entity by its natural-idprotected NaturalIdMapping
naturalIdMapping()
protected Expression
resolveColumnReference(TableGroup rootTableGroup, SelectableMapping selectableMapping, SqlExpressionResolver sqlExpressionResolver, SessionFactoryImplementor sessionFactory)
Helper to resolve ColumnReferencesObject
resolveIdToNaturalId(Object id, SharedSessionContractImplementor session)
Resolve the natural-id value(s) from an idObject
resolveNaturalIdToId(Object naturalIdValue, SharedSessionContractImplementor session)
Resolve the id from natural-id valueprotected <L> L
selectByNaturalId(Object bindValue, NaturalIdLoadOptions options, BiFunction<TableGroup,LoaderSqlAstCreationState,DomainResult<?>> domainResultProducer, LoaderSqlAstCreationState.FetchProcessor fetchProcessor, Function<Boolean,Long> statementStartHandler, BiConsumer<Object,Long> statementCompletionHandler, SharedSessionContractImplementor session)
Perform a select, restricted by natural-id, based on `domainResultProducer` and `fetchProcessor`
-
-
-
Constructor Detail
-
AbstractNaturalIdLoader
public AbstractNaturalIdLoader(NaturalIdMapping naturalIdMapping, EntityMappingType entityDescriptor)
-
-
Method Detail
-
entityDescriptor
protected EntityMappingType entityDescriptor()
-
naturalIdMapping
protected NaturalIdMapping naturalIdMapping()
-
getLoadable
public EntityMappingType getLoadable()
Description copied from interface:Loader
The value-mapping loaded by this loader- Specified by:
getLoadable
in interfaceEntityLoader
- Specified by:
getLoadable
in interfaceLoader
-
load
public T load(Object naturalIdValue, NaturalIdLoadOptions options, SharedSessionContractImplementor session)
Description copied from interface:NaturalIdLoader
Perform the load of the entity by its natural-id- Specified by:
load
in interfaceNaturalIdLoader<T>
- Parameters:
naturalIdValue
- The natural-id to load. One of 2 forms accepted: * Single-value - valid for entities with a simple (single-valued) natural-id * Map - valid for any natural-id load. The map is each value keyed by the attribute name that the value corresponds to. Even though this form is allowed for simple natural-ids, the single value form should be used as it is more efficientoptions
- The options to apply to the load operationsession
- The session into which the entity is being loaded
-
selectByNaturalId
protected <L> L selectByNaturalId(Object bindValue, NaturalIdLoadOptions options, BiFunction<TableGroup,LoaderSqlAstCreationState,DomainResult<?>> domainResultProducer, LoaderSqlAstCreationState.FetchProcessor fetchProcessor, Function<Boolean,Long> statementStartHandler, BiConsumer<Object,Long> statementCompletionHandler, SharedSessionContractImplementor session)
Perform a select, restricted by natural-id, based on `domainResultProducer` and `fetchProcessor`
-
applyNaturalIdRestriction
protected abstract void applyNaturalIdRestriction(Object bindValue, TableGroup rootTableGroup, Consumer<Predicate> predicateConsumer, BiConsumer<JdbcParameter,JdbcParameterBinding> jdbcParameterConsumer, LoaderSqlAstCreationState sqlAstCreationState, SharedSessionContractImplementor session)
Apply restriction necessary to match the given natural-id value. Should apply any predicates to `predicateConsumer` as well and any parameter / binding pairs
-
resolveColumnReference
protected Expression resolveColumnReference(TableGroup rootTableGroup, SelectableMapping selectableMapping, SqlExpressionResolver sqlExpressionResolver, SessionFactoryImplementor sessionFactory)
Helper to resolve ColumnReferences
-
resolveNaturalIdToId
public Object resolveNaturalIdToId(Object naturalIdValue, SharedSessionContractImplementor session)
Description copied from interface:NaturalIdLoader
Resolve the id from natural-id value- Specified by:
resolveNaturalIdToId
in interfaceNaturalIdLoader<T>
-
resolveIdToNaturalId
public Object resolveIdToNaturalId(Object id, SharedSessionContractImplementor session)
Description copied from interface:NaturalIdLoader
Resolve the natural-id value(s) from an id- Specified by:
resolveIdToNaturalId
in interfaceNaturalIdLoader<T>
-
-