Class EmbeddableTypeLiteral
- java.lang.Object
-
- org.hibernate.sql.ast.tree.expression.EmbeddableTypeLiteral
-
- All Implemented Interfaces:
BasicValuedMapping
,Bindable
,JdbcMappingContainer
,MappingModelExpressible
,SqlExpressible
,ValueMapping
,DomainResultProducer<Object>
,SqlSelectionProducer
,Expression
,SqlAstNode
,JavaTypedExpressible
public class EmbeddableTypeLiteral extends Object implements Expression, DomainResultProducer<Object>, BasicValuedMapping
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.hibernate.metamodel.mapping.Bindable
Bindable.JdbcValuesBiConsumer<X,Y>, Bindable.JdbcValuesConsumer
-
-
Constructor Summary
Constructors Constructor Description EmbeddableTypeLiteral(EmbeddableDomainType<?> embeddableDomainType, BasicType<?> basicType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(SqlAstWalker sqlTreeWalker)
void
addToCacheKey(MutableCacheKeyBuilder cacheKey, Object value, SharedSessionContractImplementor session)
Add to the MutableCacheKey the values obtained disassembling the value and the hasCode generated from the disassembled value.void
applySqlSelections(DomainResultCreationState creationState)
Used when this producer is a selection in a sub-query.DomainResult<Object>
createDomainResult(String resultVariable, DomainResultCreationState creationState)
Produce the domain queryObject
disassemble(Object value, SharedSessionContractImplementor session)
Breaks down a value ofJ
into its simple pieces.<X,Y>
intforEachDisassembledJdbcValue(Object value, int offset, X x, Y y, Bindable.JdbcValuesBiConsumer<X,Y> valuesConsumer, SharedSessionContractImplementor session)
LikeBindable.forEachDisassembledJdbcValue(Object, Object, Object, JdbcValuesBiConsumer, SharedSessionContractImplementor)
, but additionally receives an offset by which the selectionIndex is incremented when callingBindable.JdbcValuesBiConsumer.consume(int, Object, Object, Object, JdbcMapping)
.int
forEachJdbcType(int offset, IndexedConsumer<JdbcMapping> action)
Visit each JdbcMapping starting from the given offset<X,Y>
intforEachJdbcValue(Object value, int offset, X x, Y y, Bindable.JdbcValuesBiConsumer<X,Y> valuesConsumer, SharedSessionContractImplementor session)
Visit each constituent JDBC value extracted from the entity instance itself.Object
getEmbeddableClass()
JavaType
getExpressibleJavaType()
MappingModelExpressible<?>
getExpressionType()
The type for this expressionJdbcMapping
getJdbcMapping()
Anything that is expressible at the SQL AST level would be of basic type.JdbcMapping
getJdbcMapping(int index)
int
getJdbcTypeCount()
The number of JDBC mappingsMappingType
getMappedType()
Descriptor for the type of this mappingJdbcMapping
getSingleJdbcMapping()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.hibernate.metamodel.mapping.Bindable
forEachDisassembledJdbcValue, forEachDisassembledJdbcValue, forEachDisassembledJdbcValue, forEachJdbcType, forEachJdbcValue, forEachJdbcValue, forEachJdbcValue
-
Methods inherited from interface org.hibernate.sql.ast.tree.expression.Expression
createDomainResultSqlSelection, createSqlSelection, getColumnReference
-
Methods inherited from interface org.hibernate.metamodel.mapping.ValueMapping
treatAs
-
-
-
-
Constructor Detail
-
EmbeddableTypeLiteral
public EmbeddableTypeLiteral(EmbeddableDomainType<?> embeddableDomainType, BasicType<?> basicType)
-
-
Method Detail
-
getEmbeddableClass
public Object getEmbeddableClass()
-
getExpressionType
public MappingModelExpressible<?> getExpressionType()
Description copied from interface:Expression
The type for this expression- Specified by:
getExpressionType
in interfaceExpression
-
getJdbcMapping
public JdbcMapping getJdbcMapping()
Description copied from interface:SqlExpressible
Anything that is expressible at the SQL AST level would be of basic type.- Specified by:
getJdbcMapping
in interfaceBasicValuedMapping
- Specified by:
getJdbcMapping
in interfaceSqlExpressible
-
getMappedType
public MappingType getMappedType()
Description copied from interface:ValueMapping
Descriptor for the type of this mapping- Specified by:
getMappedType
in interfaceValueMapping
-
getJdbcTypeCount
public int getJdbcTypeCount()
Description copied from interface:Bindable
The number of JDBC mappings- Specified by:
getJdbcTypeCount
in interfaceBasicValuedMapping
- Specified by:
getJdbcTypeCount
in interfaceBindable
- Specified by:
getJdbcTypeCount
in interfaceJdbcMappingContainer
-
getJdbcMapping
public JdbcMapping getJdbcMapping(int index)
- Specified by:
getJdbcMapping
in interfaceBasicValuedMapping
- Specified by:
getJdbcMapping
in interfaceJdbcMappingContainer
- Specified by:
getJdbcMapping
in interfaceSqlExpressible
-
getSingleJdbcMapping
public JdbcMapping getSingleJdbcMapping()
- Specified by:
getSingleJdbcMapping
in interfaceBasicValuedMapping
- Specified by:
getSingleJdbcMapping
in interfaceJdbcMappingContainer
-
forEachJdbcType
public int forEachJdbcType(int offset, IndexedConsumer<JdbcMapping> action)
Description copied from interface:JdbcMappingContainer
Visit each JdbcMapping starting from the given offset- Specified by:
forEachJdbcType
in interfaceJdbcMappingContainer
-
disassemble
public Object disassemble(Object value, SharedSessionContractImplementor session)
Description copied from interface:Bindable
Breaks down a value ofJ
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 theBindable
for thePerson
entity to disassemble. Given aPerson
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.
- Specified by:
disassemble
in interfaceBasicValuedMapping
- Specified by:
disassemble
in interfaceBindable
- See Also:
EntityEntry
-
addToCacheKey
public void addToCacheKey(MutableCacheKeyBuilder cacheKey, Object value, SharedSessionContractImplementor session)
Description copied from interface:Bindable
Add to the MutableCacheKey the values obtained disassembling the value and the hasCode generated from the disassembled value.- Specified by:
addToCacheKey
in interfaceBasicValuedMapping
- Specified by:
addToCacheKey
in interfaceBindable
- Specified by:
addToCacheKey
in interfaceJavaTypedExpressible
- Parameters:
cacheKey
- the MutableCacheKey used to add the disassembled value and the hashCodevalue
- the value to disassemblesession
- the SharedSessionContractImplementor
-
forEachDisassembledJdbcValue
public <X,Y> int forEachDisassembledJdbcValue(Object value, int offset, X x, Y y, Bindable.JdbcValuesBiConsumer<X,Y> valuesConsumer, SharedSessionContractImplementor session)
Description copied from interface:Bindable
LikeBindable.forEachDisassembledJdbcValue(Object, Object, Object, JdbcValuesBiConsumer, SharedSessionContractImplementor)
, but additionally receives an offset by which the selectionIndex is incremented when callingBindable.JdbcValuesBiConsumer.consume(int, Object, Object, Object, JdbcMapping)
.- Specified by:
forEachDisassembledJdbcValue
in interfaceBindable
-
forEachJdbcValue
public <X,Y> int forEachJdbcValue(Object value, int offset, X x, Y y, Bindable.JdbcValuesBiConsumer<X,Y> valuesConsumer, SharedSessionContractImplementor session)
Description copied from interface:Bindable
Visit each constituent JDBC value extracted from the entity instance itself. Short-hand form of callingBindable.disassemble(java.lang.Object, org.hibernate.engine.spi.SharedSessionContractImplementor)
and piping its result toBindable.forEachDisassembledJdbcValue(Object, int, JdbcValuesConsumer, SharedSessionContractImplementor)
- Specified by:
forEachJdbcValue
in interfaceBindable
-
applySqlSelections
public void applySqlSelections(DomainResultCreationState creationState)
Description copied from interface:DomainResultProducer
Used when this producer is a selection in a sub-query. The DomainResult is only needed for root query of a SELECT statement. This default impl assumes this producer is a true (Sql)Expression- Specified by:
applySqlSelections
in interfaceDomainResultProducer<Object>
-
createDomainResult
public DomainResult<Object> createDomainResult(String resultVariable, DomainResultCreationState creationState)
Description copied from interface:DomainResultProducer
Produce the domain query- Specified by:
createDomainResult
in interfaceDomainResultProducer<Object>
-
accept
public void accept(SqlAstWalker sqlTreeWalker)
- Specified by:
accept
in interfaceSqlAstNode
-
getExpressibleJavaType
public JavaType getExpressibleJavaType()
- Specified by:
getExpressibleJavaType
in interfaceJavaTypedExpressible
- Specified by:
getExpressibleJavaType
in interfaceValueMapping
-
-