Top Description Fields Constructors Methods
org.hibernate.sql.ast.tree.expression

public Class JdbcLiteral<T>

extends Object
implements Literal, MappingModelExpressible<T>, DomainResultProducer<T>, JavaTypedExpressible<T>
Class Inheritance
All Implemented Interfaces
org.hibernate.type.descriptor.java.JavaTypedExpressible, org.hibernate.query.sqm.sql.internal.DomainResultProducer, org.hibernate.metamodel.mapping.MappingModelExpressible, org.hibernate.metamodel.mapping.Bindable, org.hibernate.metamodel.mapping.JdbcMappingContainer, org.hibernate.sql.ast.tree.expression.Literal, org.hibernate.sql.ast.tree.expression.Expression, org.hibernate.sql.ast.spi.SqlSelectionProducer, org.hibernate.sql.ast.tree.SqlAstNode, org.hibernate.sql.exec.spi.JdbcParameterBinder
Imports
java.io.Serializable, java.sql.PreparedStatement, .SQLException, org.hibernate.cache.MutableCacheKeyBuilder, org.hibernate.engine.spi.SharedSessionContractImplementor, org.hibernate.internal.util.IndexedConsumer, org.hibernate.metamodel.mapping.JdbcMapping, .MappingModelExpressible, org.hibernate.query.sqm.sql.internal.DomainResultProducer, org.hibernate.sql.ast.SqlAstWalker, org.hibernate.sql.ast.spi.SqlAstCreationState, .SqlExpressionResolver, .SqlSelection, org.hibernate.sql.exec.spi.ExecutionContext, .JdbcParameterBindings, org.hibernate.sql.results.graph.DomainResult, .DomainResultCreationState, org.hibernate.sql.results.graph.basic.BasicResult, org.hibernate.type.descriptor.java.JavaType, .JavaTypedExpressible, .MutabilityPlan

Represents a literal in the SQL AST. This form accepts a JdbcMapping and acts as its own MappingModelExpressible.
Author
Steve Ebersole
See Also
QueryLiteral

Field Summary

Modifier and TypeField and Description
private final JdbcMapping
private final T

Constructor Summary

AccessConstructor and Description
public
JdbcLiteral(T literalValue, JdbcMapping jdbcMapping)

Method Summary

Modifier and TypeMethod and Description
public void
public void
addToCacheKey(MutableCacheKeyBuilder
the MutableCacheKey used to add the disassembled value and the hashCode
cacheKey
,
Object
the value to disassemble
value
,
SharedSessionContractImplementor
the SharedSessionContractImplementor
session
)

Implements org.hibernate.metamodel.mapping.Bindable.addToCacheKey, org.hibernate.type.descriptor.java.JavaTypedExpressible.addToCacheKey.

Add to the MutableCacheKey the values obtained disassembling the value and the hasCode generated from the disassembled value.
public void
applySqlSelections(DomainResultCreationState creationState)

Implements org.hibernate.query.sqm.sql.internal.DomainResultProducer.applySqlSelections.

Used when this producer is a selection in a sub-query.
public void
bindParameterValue(PreparedStatement statement, int startPosition, JdbcParameterBindings jdbcParameterBindings, ExecutionContext executionContext)

Implements org.hibernate.sql.exec.spi.JdbcParameterBinder.bindParameterValue.

Bind the appropriate value in the JDBC statement
public DomainResult<T>
public Object
disassemble(Object value, SharedSessionContractImplementor session)

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

Breaks down a value of J into its simple pieces.
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 <X, Y> int
forEachJdbcValue(Object value, int offset, X x, Y y, Bindable.JdbcValuesBiConsumer<X, Y> valuesConsumer, SharedSessionContractImplementor session)

Overrides default org.hibernate.metamodel.mapping.Bindable.forEachJdbcValue.

Visit each constituent JDBC value extracted from the entity instance itself.
public JavaType<T>
public MappingModelExpressible<T>
public JdbcMapping
public JdbcMapping
public int
getJdbcTypeCount()

Overrides default org.hibernate.metamodel.mapping.Bindable.getJdbcTypeCount.

The number of JDBC mappings
public Object
public JdbcMapping
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

jdbcMappingback to summary
private final JdbcMapping jdbcMapping
literalValueback to summary
private final T literalValue

Constructor Detail

JdbcLiteralback to summary
public JdbcLiteral(T literalValue, JdbcMapping jdbcMapping)

Method Detail

acceptback to summary
public void accept(SqlAstWalker sqlTreeWalker)

Implements org.hibernate.sql.ast.tree.SqlAstNode.accept.

Annotations
@Override
addToCacheKeyback to summary
public void addToCacheKey(MutableCacheKeyBuilder cacheKey, Object value, SharedSessionContractImplementor session)

Implements org.hibernate.metamodel.mapping.Bindable.addToCacheKey, org.hibernate.type.descriptor.java.JavaTypedExpressible.addToCacheKey.

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

Add to the MutableCacheKey the values obtained disassembling the value and the hasCode generated from the disassembled value.

Parameters
cacheKey:MutableCacheKeyBuilder

the MutableCacheKey used to add the disassembled value and the hashCode

value:Object

the value to disassemble

session:SharedSessionContractImplementor

the SharedSessionContractImplementor

Annotations
@Override
applySqlSelectionsback to summary
public void applySqlSelections(DomainResultCreationState creationState)

Implements org.hibernate.query.sqm.sql.internal.DomainResultProducer.applySqlSelections.

Doc from org.hibernate.query.sqm.sql.internal.DomainResultProducer.applySqlSelections.

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

Annotations
@Override
bindParameterValueback to summary
public void bindParameterValue(PreparedStatement statement, int startPosition, JdbcParameterBindings jdbcParameterBindings, ExecutionContext executionContext) throws SQLException

Implements org.hibernate.sql.exec.spi.JdbcParameterBinder.bindParameterValue.

Doc from org.hibernate.sql.exec.spi.JdbcParameterBinder.bindParameterValue.

Bind the appropriate value in the JDBC statement

Annotations
@Override
createDomainResultback to summary
public DomainResult<T> createDomainResult(String resultVariable, DomainResultCreationState creationState)

Implements org.hibernate.query.sqm.sql.internal.DomainResultProducer.createDomainResult.

Doc from org.hibernate.query.sqm.sql.internal.DomainResultProducer.createDomainResult.

Produce the domain query

Annotations
@Override
disassembleback to summary
public Object disassemble(Object value, SharedSessionContractImplementor session)

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
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
forEachJdbcValueback to summary
public <X, Y> int forEachJdbcValue(Object value, int offset, X x, Y y, Bindable.JdbcValuesBiConsumer<X, Y> valuesConsumer, SharedSessionContractImplementor session)

Overrides default org.hibernate.metamodel.mapping.Bindable.forEachJdbcValue.

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

Visit each constituent JDBC value extracted from the entity instance itself. Short-hand form of calling disassemble and piping its result to forEachDisassembledJdbcValue(Object, int, JdbcValuesConsumer, SharedSessionContractImplementor)

Annotations
@Override
getExpressibleJavaTypeback to summary
public JavaType<T> getExpressibleJavaType()

Implements org.hibernate.type.descriptor.java.JavaTypedExpressible.getExpressibleJavaType.

Annotations
@Override
getExpressionTypeback to summary
public MappingModelExpressible<T> getExpressionType()

Implements org.hibernate.sql.ast.tree.expression.Expression.getExpressionType.

Doc from org.hibernate.sql.ast.tree.expression.Expression.getExpressionType.

The type for this expression

Annotations
@Override
getJdbcMappingback to summary
public JdbcMapping getJdbcMapping()

Implements org.hibernate.sql.ast.tree.expression.Literal.getJdbcMapping.

Annotations
@Override
getJdbcMappingback to summary
public JdbcMapping getJdbcMapping(int index)

Implements org.hibernate.metamodel.mapping.JdbcMappingContainer.getJdbcMapping.

Annotations
@Override
getJdbcTypeCountback to summary
public int getJdbcTypeCount()

Overrides default org.hibernate.metamodel.mapping.Bindable.getJdbcTypeCount.

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

The number of JDBC mappings

Annotations
@Override
getLiteralValueback to summary
public Object getLiteralValue()

Implements org.hibernate.sql.ast.tree.expression.Literal.getLiteralValue.

Annotations
@Override
getSingleJdbcMappingback to summary
public JdbcMapping getSingleJdbcMapping()

Overrides default org.hibernate.metamodel.mapping.JdbcMappingContainer.getSingleJdbcMapping.

Annotations
@Override