Top Fields Constructors Methods
org.hibernate.metamodel.mapping.internal

public abstract Class AbstractDiscriminatorMapping

extends Object
implements EntityDiscriminatorMapping
Class Inheritance
All Implemented Interfaces
org.hibernate.metamodel.mapping.EntityDiscriminatorMapping, org.hibernate.sql.results.graph.FetchOptions, org.hibernate.sql.results.graph.FetchStyleAccess, org.hibernate.sql.results.graph.FetchTimingAccess, org.hibernate.metamodel.mapping.DiscriminatorMapping, org.hibernate.sql.results.graph.Fetchable, org.hibernate.metamodel.mapping.ModelPart, org.hibernate.metamodel.mapping.MappingModelExpressible, org.hibernate.metamodel.mapping.Bindable, org.hibernate.metamodel.mapping.JdbcMappingContainer, org.hibernate.metamodel.mapping.BasicValuedModelPart, org.hibernate.metamodel.mapping.SelectableMapping, org.hibernate.metamodel.mapping.SqlTypedMapping, org.hibernate.metamodel.mapping.ValuedModelPart, org.hibernate.metamodel.mapping.SelectableMappings, org.hibernate.metamodel.mapping.ValueMapping, org.hibernate.type.descriptor.java.JavaTypedExpressible, org.hibernate.metamodel.mapping.BasicValuedMapping, org.hibernate.metamodel.mapping.SqlExpressible, org.hibernate.metamodel.mapping.VirtualModelPart
Known Direct Subclasses
org.hibernate.metamodel.mapping.internal.ExplicitColumnDiscriminatorMappingImpl, org.hibernate.metamodel.mapping.internal.CaseStatementDiscriminatorMappingImpl
Imports
java.util.function.BiConsumer, org.hibernate.engine.FetchTiming, org.hibernate.engine.spi.SharedSessionContractImplementor, org.hibernate.internal.util.IndexedConsumer, org.hibernate.metamodel.mapping.DiscriminatorConverter, .DiscriminatorType, .DiscriminatorValueDetails, .EntityDiscriminatorMapping, .EntityMappingType, .JdbcMapping, .MappingType, .SelectableConsumer, org.hibernate.metamodel.model.domain.NavigableRole, org.hibernate.spi.NavigablePath, org.hibernate.sql.ast.spi.SqlAstCreationState, .SqlExpressionResolver, .SqlSelection, org.hibernate.sql.ast.tree.from.TableGroup, org.hibernate.sql.results.graph.DomainResult, .DomainResultCreationState, .FetchParent, org.hibernate.sql.results.graph.basic.BasicFetch, .BasicResult, org.hibernate.type.BasicType, org.hibernate.type.descriptor.java.JavaType

Implementation Note

`discriminatorType` represents the mapping to Class, whereas `discriminatorType.getUnderlyingType()` represents the "raw" JDBC mapping (String, Integer, etc)

Author
Steve Ebersole

Field Summary

Modifier and TypeField and Description
private final DiscriminatorType<Object>
private final EntityMappingType
private final NavigableRole
private final BasicType<Object>

Constructor Summary

AccessConstructor and Description
public
AbstractDiscriminatorMapping(EntityMappingType entityDescriptor, DiscriminatorType<Object> discriminatorType, BasicType<Object> underlyingJdbcMapping)

Method Summary

Modifier and TypeMethod and Description
public void
applySqlSelections(NavigablePath navigablePath, TableGroup tableGroup, DomainResultCreationState creationState)

Implements org.hibernate.metamodel.mapping.ModelPart.applySqlSelections.

Apply SQL selections for a specific reference to this ModelPart outside the domain query's root select clause.
public void
applySqlSelections(NavigablePath navigablePath, TableGroup tableGroup, DomainResultCreationState creationState, BiConsumer<SqlSelection, JdbcMapping> selectionConsumer)

Implements org.hibernate.metamodel.mapping.ModelPart.applySqlSelections.

Apply SQL selections for a specific reference to this ModelPart outside the domain query's root select clause.
public <X, Y> int
breakDownJdbcValues(Object domainValue, int offset, X x, Y y, ModelPart.JdbcValueBiConsumer<X, Y> valueConsumer, SharedSessionContractImplementor session)

Implements org.hibernate.metamodel.mapping.ModelPart.breakDownJdbcValues.

Breaks down the domain value to its constituent JDBC values.
public DomainResult<J>
createDomainResult(NavigablePath navigablePath, TableGroup tableGroup, String resultVariable, DomainResultCreationState creationState)

Implements org.hibernate.metamodel.mapping.ModelPart.createDomainResult.

Create a DomainResult for a specific reference to this ModelPart.
public Object
public EntityMappingType
public <X, Y> int
public int
forEachJdbcType(int offset, IndexedConsumer<JdbcMapping> action)

Implements org.hibernate.metamodel.mapping.JdbcMappingContainer.forEachJdbcType.

Visit each JdbcMapping starting from the given offset
public int
forEachSelectable(int offset, SelectableConsumer consumer)

Overrides default org.hibernate.metamodel.mapping.ModelPart.forEachSelectable, org.hibernate.metamodel.mapping.BasicValuedModelPart.forEachSelectable.

Visits each selectable mapping with the selectable index offset by the given value.
public BasicFetch<?>
generateFetch(FetchParent
The parent of the Fetch we are generating
fetchParent
,
NavigablePath
The overall path within the graph
fetchablePath
,
FetchTiming
The requested fetch timing
fetchTiming
,
boolean selected, String resultVariable, DomainResultCreationState creationState)

Implements org.hibernate.metamodel.mapping.EntityDiscriminatorMapping.generateFetch.

Generates a Fetch of this fetchable
public EntityMappingType
public JavaType<?>
getJavaType()

Implements org.hibernate.metamodel.mapping.ModelPart.getJavaType.

The Java type for this part.
public JdbcMapping
public MappingType
getMappedType()

Implements org.hibernate.metamodel.mapping.ValueMapping.getMappedType.

Descriptor for the type of this mapping
public NavigableRole
public BasicType<?>
public DiscriminatorConverter<?, ?>
public DiscriminatorValueDetails
resolveDiscriminatorValue(Object value)

Implements org.hibernate.metamodel.mapping.EntityDiscriminatorMapping.resolveDiscriminatorValue.

Retrieve the details for a particular discriminator value.
private SqlSelection
resolveSqlSelection(NavigablePath navigablePath, JdbcMapping jdbcMappingToUse, TableGroup tableGroup, FetchParent fetchParent, SqlAstCreationState creationState)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

discriminatorTypeback to summary
private final DiscriminatorType<Object> discriminatorType
entityDescriptorback to summary
private final EntityMappingType entityDescriptor
roleback to summary
private final NavigableRole role
underlyingJdbcMappingback to summary
private final BasicType<Object> underlyingJdbcMapping

Constructor Detail

AbstractDiscriminatorMappingback to summary
public AbstractDiscriminatorMapping(EntityMappingType entityDescriptor, DiscriminatorType<Object> discriminatorType, BasicType<Object> underlyingJdbcMapping)

Method Detail

applySqlSelectionsback to summary
public void applySqlSelections(NavigablePath navigablePath, TableGroup tableGroup, DomainResultCreationState creationState)

Implements org.hibernate.metamodel.mapping.ModelPart.applySqlSelections.

Doc from org.hibernate.metamodel.mapping.ModelPart.applySqlSelections.

Apply SQL selections for a specific reference to this ModelPart outside the domain query's root select clause.

Annotations
@Override
applySqlSelectionsback to summary
public void applySqlSelections(NavigablePath navigablePath, TableGroup tableGroup, DomainResultCreationState creationState, BiConsumer<SqlSelection, JdbcMapping> selectionConsumer)

Implements org.hibernate.metamodel.mapping.ModelPart.applySqlSelections.

Doc from org.hibernate.metamodel.mapping.ModelPart.applySqlSelections.

Apply SQL selections for a specific reference to this ModelPart outside the domain query's root select clause.

Annotations
@Override
breakDownJdbcValuesback to summary
public <X, Y> int breakDownJdbcValues(Object domainValue, int offset, X x, Y y, ModelPart.JdbcValueBiConsumer<X, Y> valueConsumer, SharedSessionContractImplementor session)

Implements org.hibernate.metamodel.mapping.ModelPart.breakDownJdbcValues.

Doc from org.hibernate.metamodel.mapping.ModelPart.breakDownJdbcValues.

Breaks down the domain value to its constituent JDBC values. Think of it as breaking the multi-dimensional array into a visitable flat array. Additionally, it passes through the values X and Y to the consumer. Returns the amount of jdbc types that have been visited.

Annotations
@Override
createDomainResultback to summary
public DomainResult<J> createDomainResult(NavigablePath navigablePath, TableGroup tableGroup, String resultVariable, DomainResultCreationState creationState)

Implements org.hibernate.metamodel.mapping.ModelPart.createDomainResult.

Doc from org.hibernate.metamodel.mapping.ModelPart.createDomainResult.

Create a DomainResult for a specific reference to this ModelPart.

Annotations
@SuppressWarnings:rawtypes, unchecked
@Override
disassembleback to summary
public Object disassemble(Object value, SharedSessionContractImplementor session)

Overrides default org.hibernate.metamodel.mapping.BasicValuedMapping.disassemble.

Implements org.hibernate.metamodel.mapping.Bindable.disassemble.

Doc from org.hibernate.metamodel.mapping.Bindable.disassemble.

Breaks down a value of J into its simple pieces. E.g., an embedded value gets broken down into an array of its attribute state; a basic value converts to itself; etc.

Generally speaking, this is the form in which entity state is kept relative to a Session via EntityEntry.

@Entity class Person {
    @Id Integer id;
    @Embedded Name name;
    int age;
}

@Embeddable class Name {
    String familiarName;
    String familyName;
}

At the top level, we would want to disassemble a Person value, so we'd ask the Bindable for the Person entity to disassemble. Given a Person value:

Person( id=1, name=Name( 'Steve', 'Ebersole' ), 28 )

this disassemble would result in a multidimensional array:

[ ["Steve", "Ebersole"], 28 ]

Note that the identifier is not part of this disassembled state. Note also how the embedded value results in a sub-array.

Annotations
@Override
findContainingEntityMappingback to summary
public EntityMappingType findContainingEntityMapping()

Implements org.hibernate.metamodel.mapping.ModelPart.findContainingEntityMapping.

Annotations
@Override
forEachDisassembledJdbcValueback to summary
public <X, Y> int forEachDisassembledJdbcValue(Object value, int offset, X x, Y y, Bindable.JdbcValuesBiConsumer<X, Y> valuesConsumer, SharedSessionContractImplementor session)

Implements org.hibernate.metamodel.mapping.Bindable.forEachDisassembledJdbcValue.

Doc from org.hibernate.metamodel.mapping.Bindable.forEachDisassembledJdbcValue.

Like forEachDisassembledJdbcValue(Object, Object, Object, JdbcValuesBiConsumer, SharedSessionContractImplementor), but additionally receives an offset by which the selectionIndex is incremented when calling JdbcValuesBiConsumer#consume(int, Object, Object, Object, JdbcMapping).

Annotations
@Override
forEachJdbcTypeback to summary
public int forEachJdbcType(int offset, IndexedConsumer<JdbcMapping> action)

Implements org.hibernate.metamodel.mapping.JdbcMappingContainer.forEachJdbcType.

Doc from org.hibernate.metamodel.mapping.JdbcMappingContainer.forEachJdbcType.

Visit each JdbcMapping starting from the given offset

Annotations
@Override
forEachSelectableback to summary
public int forEachSelectable(int offset, SelectableConsumer consumer)

Overrides default org.hibernate.metamodel.mapping.ModelPart.forEachSelectable, org.hibernate.metamodel.mapping.BasicValuedModelPart.forEachSelectable.

Doc from org.hibernate.metamodel.mapping.ModelPart.forEachSelectable.

Visits each selectable mapping with the selectable index offset by the given value. Returns the amount of jdbc types that have been visited.

Annotations
@Override
generateFetchback to summary
public BasicFetch<?> generateFetch(FetchParent fetchParent, NavigablePath fetchablePath, FetchTiming fetchTiming, boolean selected, String resultVariable, DomainResultCreationState creationState)

Implements org.hibernate.metamodel.mapping.EntityDiscriminatorMapping.generateFetch.

Doc from org.hibernate.sql.results.graph.Fetchable.generateFetch.

Generates a Fetch of this fetchable

Parameters
fetchParent:FetchParent

The parent of the Fetch we are generating

fetchablePath:NavigablePath

The overall path within the graph

fetchTiming:FetchTiming

The requested fetch timing

Annotations
@Override
getEntityDescriptorback to summary
public EntityMappingType getEntityDescriptor()
getJavaTypeback to summary
public JavaType<?> getJavaType()

Implements org.hibernate.metamodel.mapping.ModelPart.getJavaType.

Doc from org.hibernate.metamodel.mapping.ModelPart.getJavaType.

The Java type for this part. Generally equivalent to MappingType#getMappedJavaType() relative to getPartMappingType()

Annotations
@Override
getJdbcMappingback to summary
public JdbcMapping getJdbcMapping()

Implements org.hibernate.metamodel.mapping.BasicValuedMapping.getJdbcMapping, org.hibernate.metamodel.mapping.SqlTypedMapping.getJdbcMapping.

Doc from org.hibernate.metamodel.mapping.SqlExpressible.getJdbcMapping.

Anything that is expressible at the SQL AST level would be of basic type.

Annotations
@Override
getMappedTypeback to summary
public MappingType getMappedType()

Implements org.hibernate.metamodel.mapping.ValueMapping.getMappedType.

Doc from org.hibernate.metamodel.mapping.ValueMapping.getMappedType.

Descriptor for the type of this mapping

Annotations
@Override
getNavigableRoleback to summary
public NavigableRole getNavigableRole()

Implements org.hibernate.metamodel.mapping.ModelPart.getNavigableRole.

Annotations
@Override
getUnderlyingJdbcMappingback to summary
public BasicType<?> getUnderlyingJdbcMapping()

Implements org.hibernate.metamodel.mapping.DiscriminatorMapping.getUnderlyingJdbcMapping.

Annotations
@Override
getValueConverterback to summary
public DiscriminatorConverter<?, ?> getValueConverter()

Implements org.hibernate.metamodel.mapping.DiscriminatorMapping.getValueConverter.

Doc from org.hibernate.metamodel.mapping.DiscriminatorMapping.getValueConverter.

Information about the value mappings

Annotations
@Override
resolveDiscriminatorValueback to summary
public DiscriminatorValueDetails resolveDiscriminatorValue(Object value)

Implements org.hibernate.metamodel.mapping.EntityDiscriminatorMapping.resolveDiscriminatorValue.

Doc from org.hibernate.metamodel.mapping.EntityDiscriminatorMapping.resolveDiscriminatorValue.

Retrieve the details for a particular discriminator value. Returns null if there is no match.

Annotations
@Override
resolveSqlSelectionback to summary
private SqlSelection resolveSqlSelection(NavigablePath navigablePath, JdbcMapping jdbcMappingToUse, TableGroup tableGroup, FetchParent fetchParent, SqlAstCreationState creationState)