Package org.hibernate.query.sqm.function
Class SelfRenderingFunctionSqlAstExpression
java.lang.Object
org.hibernate.query.sqm.function.SelfRenderingFunctionSqlAstExpression
- All Implemented Interfaces:
Selectable
,JdbcMappingContainer
,SqlExpressible
,DomainResultProducer
,SqlSelectionProducer
,Expression
,FunctionExpression
,SelfRenderingExpression
,SqlAstNode
- Direct Known Subclasses:
SelfRenderingAggregateFunctionSqlAstExpression
,SelfRenderingWindowFunctionSqlAstExpression
public class SelfRenderingFunctionSqlAstExpression
extends Object
implements SelfRenderingExpression, Selectable, SqlExpressible, DomainResultProducer, FunctionExpression
Representation of a function call in the SQL AST for impls that know how to
render themselves.
-
Constructor Summary
ConstructorsConstructorDescriptionSelfRenderingFunctionSqlAstExpression
(String functionName, FunctionRenderer renderer, List<? extends SqlAstNode> sqlAstArguments, @Nullable ReturnableType<?> type, @Nullable JdbcMappingContainer expressible) -
Method Summary
Modifier and TypeMethodDescriptionvoid
applySqlSelections
(DomainResultCreationState creationState) Used when this producer is a selection in a sub-query.DomainResult<?>
createDomainResult
(String resultVariable, DomainResultCreationState creationState) Produce the domain querycreateSqlSelection
(int jdbcPosition, int valuesArrayPosition, JavaType javaType, boolean virtual, TypeConfiguration typeConfiguration) Create a SqlSelection for the given JDBC ResultSet positionint
forEachJdbcType
(int offset, IndexedConsumer<JdbcMapping> action) Visit each JdbcMapping starting from the given offsetList<? extends SqlAstNode>
Any custom read expression for this selectable.Any custom write expression for this selectable.The type for this expressionprotected FunctionRenderer
Anything that is expressible at the SQL AST level would be of basic type.getTemplate
(Dialect dialect, TypeConfiguration typeConfiguration, SqmFunctionRegistry registry) getText()
The selectable's "canonical" text representationThe selectable's text representation accounting for the Dialect's quoting, if quotedprotected @Nullable ReturnableType<?>
getType()
boolean
Does this selectable represent a formula?true
indicates it is a formula;false
indicates it is a physical columnvoid
renderToSql
(SqlAppender sqlAppender, SqlAstTranslator<?> walker, SessionFactoryImplementor sessionFactory) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.hibernate.sql.ast.tree.expression.Expression
createDomainResultSqlSelection, getColumnReference
Methods inherited from interface org.hibernate.metamodel.mapping.JdbcMappingContainer
forEachJdbcType, getJdbcTypeCount, getSingleJdbcMapping
Methods inherited from interface org.hibernate.mapping.Selectable
getWriteExpr, getWriteExpr
Methods inherited from interface org.hibernate.sql.ast.tree.expression.SelfRenderingExpression
accept
Methods inherited from interface org.hibernate.metamodel.mapping.SqlExpressible
getJdbcMapping
-
Constructor Details
-
SelfRenderingFunctionSqlAstExpression
public SelfRenderingFunctionSqlAstExpression(String functionName, FunctionRenderer renderer, List<? extends SqlAstNode> sqlAstArguments, @Nullable ReturnableType<?> type, @Nullable JdbcMappingContainer expressible)
-
-
Method Details
-
getFunctionName
- Specified by:
getFunctionName
in interfaceFunctionExpression
-
getArguments
- Specified by:
getArguments
in interfaceFunctionExpression
-
getExpressionType
Description copied from interface:Expression
The type for this expression- Specified by:
getExpressionType
in interfaceExpression
-
getFunctionRenderer
-
getType
-
createSqlSelection
public SqlSelection createSqlSelection(int jdbcPosition, int valuesArrayPosition, JavaType javaType, boolean virtual, TypeConfiguration typeConfiguration) Description copied from interface:SqlSelectionProducer
Create a SqlSelection for the given JDBC ResultSet position- Specified by:
createSqlSelection
in interfaceExpression
- Specified by:
createSqlSelection
in interfaceSqlSelectionProducer
- Parameters:
jdbcPosition
- The index position used to read values from JDBCvaluesArrayPosition
- The position in our "current JDBC values array"javaType
- The descriptor for the Java type to read the value asvirtual
- Whether the select is virtual or real. SeeSqlSelection.isVirtual()
typeConfiguration
- The associated TypeConfiguration
-
createDomainResult
public DomainResult<?> createDomainResult(String resultVariable, DomainResultCreationState creationState) Description copied from interface:DomainResultProducer
Produce the domain query- Specified by:
createDomainResult
in interfaceDomainResultProducer
-
renderToSql
public void renderToSql(SqlAppender sqlAppender, SqlAstTranslator<?> walker, SessionFactoryImplementor sessionFactory) - Specified by:
renderToSql
in interfaceSelfRenderingExpression
-
getAlias
- Specified by:
getAlias
in interfaceSelectable
-
getAlias
- Specified by:
getAlias
in interfaceSelectable
-
isFormula
public boolean isFormula()Description copied from interface:Selectable
Does this selectable represent a formula?true
indicates it is a formula;false
indicates it is a physical column- Specified by:
isFormula
in interfaceSelectable
-
getTemplate
public String getTemplate(Dialect dialect, TypeConfiguration typeConfiguration, SqmFunctionRegistry registry) - Specified by:
getTemplate
in interfaceSelectable
-
getText
Description copied from interface:Selectable
The selectable's text representation accounting for the Dialect's quoting, if quoted- Specified by:
getText
in interfaceSelectable
-
getText
Description copied from interface:Selectable
The selectable's "canonical" text representation- Specified by:
getText
in interfaceSelectable
-
getCustomReadExpression
Description copied from interface:Selectable
Any custom read expression for this selectable. Only pertinent for physical columns (not formulas)- Specified by:
getCustomReadExpression
in interfaceSelectable
- See Also:
-
getCustomWriteExpression
Description copied from interface:Selectable
Any custom write expression for this selectable. Only pertinent for physical columns (not formulas)- Specified by:
getCustomWriteExpression
in interfaceSelectable
- See Also:
-
getJdbcMapping
Description copied from interface:SqlExpressible
Anything that is expressible at the SQL AST level would be of basic type.- Specified by:
getJdbcMapping
in interfaceSqlExpressible
-
applySqlSelections
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
-
forEachJdbcType
Description copied from interface:JdbcMappingContainer
Visit each JdbcMapping starting from the given offset- Specified by:
forEachJdbcType
in interfaceJdbcMappingContainer
-