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
Constructors Constructor Description SelfRenderingFunctionSqlAstExpression(String functionName, FunctionRenderer renderer, List<? extends SqlAstNode> sqlAstArguments, @Nullable ReturnableType<?> type, @Nullable JdbcMappingContainer expressible)SelfRenderingFunctionSqlAstExpression(String functionName, FunctionRenderingSupport renderer, List<? extends SqlAstNode> sqlAstArguments, @Nullable ReturnableType<?> type, @Nullable JdbcMappingContainer expressible)Deprecated, for removal: This API element is subject to removal in a future version.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidapplySqlSelections(DomainResultCreationState creationState)Used when this producer is a selection in a sub-query.DomainResult<?>createDomainResult(String resultVariable, DomainResultCreationState creationState)Produce the domain querySqlSelectioncreateSqlSelection(int jdbcPosition, int valuesArrayPosition, JavaType javaType, boolean virtual, TypeConfiguration typeConfiguration)Create a SqlSelection for the given JDBC ResultSet positionintforEachJdbcType(int offset, IndexedConsumer<JdbcMapping> action)Visit each JdbcMapping starting from the given offsetStringgetAlias(Dialect dialect)StringgetAlias(Dialect dialect, Table table)List<? extends SqlAstNode>getArguments()StringgetCustomReadExpression()Any custom read expression for this selectable.StringgetCustomWriteExpression()Any custom write expression for this selectable.JdbcMappingContainergetExpressionType()The type for this expressionStringgetFunctionName()protected FunctionRenderergetFunctionRenderer()JdbcMappinggetJdbcMapping()Anything that is expressible at the SQL AST level would be of basic type.protected FunctionRenderingSupportgetRenderer()Deprecated, for removal: This API element is subject to removal in a future version.UsegetFunctionRenderer()insteadStringgetTemplate(Dialect dialect, TypeConfiguration typeConfiguration, SqmFunctionRegistry registry)StringgetText()The selectable's "canonical" text representationStringgetText(Dialect dialect)The selectable's text representation accounting for the Dialect's quoting, if quotedprotected @Nullable ReturnableType<?>getType()booleanisFormula()Does this selectable represent a formula?trueindicates it is a formula;falseindicates it is a physical columnvoidrenderToSql(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 Detail
-
SelfRenderingFunctionSqlAstExpression
@Deprecated(forRemoval=true) public SelfRenderingFunctionSqlAstExpression(String functionName, FunctionRenderingSupport renderer, List<? extends SqlAstNode> sqlAstArguments, @Nullable ReturnableType<?> type, @Nullable JdbcMappingContainer expressible)
Deprecated, for removal: This API element is subject to removal in a future version.
-
SelfRenderingFunctionSqlAstExpression
public SelfRenderingFunctionSqlAstExpression(String functionName, FunctionRenderer renderer, List<? extends SqlAstNode> sqlAstArguments, @Nullable ReturnableType<?> type, @Nullable JdbcMappingContainer expressible)
-
-
Method Detail
-
getFunctionName
public String getFunctionName()
- Specified by:
getFunctionNamein interfaceFunctionExpression
-
getArguments
public List<? extends SqlAstNode> getArguments()
- Specified by:
getArgumentsin interfaceFunctionExpression
-
getExpressionType
public JdbcMappingContainer getExpressionType()
Description copied from interface:ExpressionThe type for this expression- Specified by:
getExpressionTypein interfaceExpression
-
getRenderer
@Deprecated(forRemoval=true) protected FunctionRenderingSupport getRenderer()
Deprecated, for removal: This API element is subject to removal in a future version.UsegetFunctionRenderer()instead
-
getFunctionRenderer
protected FunctionRenderer getFunctionRenderer()
-
getType
protected @Nullable ReturnableType<?> getType()
-
createSqlSelection
public SqlSelection createSqlSelection(int jdbcPosition, int valuesArrayPosition, JavaType javaType, boolean virtual, TypeConfiguration typeConfiguration)
Description copied from interface:SqlSelectionProducerCreate a SqlSelection for the given JDBC ResultSet position- Specified by:
createSqlSelectionin interfaceExpression- Specified by:
createSqlSelectionin 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:DomainResultProducerProduce the domain query- Specified by:
createDomainResultin interfaceDomainResultProducer
-
renderToSql
public void renderToSql(SqlAppender sqlAppender, SqlAstTranslator<?> walker, SessionFactoryImplementor sessionFactory)
- Specified by:
renderToSqlin interfaceSelfRenderingExpression
-
getAlias
public String getAlias(Dialect dialect)
- Specified by:
getAliasin interfaceSelectable
-
getAlias
public String getAlias(Dialect dialect, Table table)
- Specified by:
getAliasin interfaceSelectable
-
isFormula
public boolean isFormula()
Description copied from interface:SelectableDoes this selectable represent a formula?trueindicates it is a formula;falseindicates it is a physical column- Specified by:
isFormulain interfaceSelectable
-
getTemplate
public String getTemplate(Dialect dialect, TypeConfiguration typeConfiguration, SqmFunctionRegistry registry)
- Specified by:
getTemplatein interfaceSelectable
-
getText
public String getText(Dialect dialect)
Description copied from interface:SelectableThe selectable's text representation accounting for the Dialect's quoting, if quoted- Specified by:
getTextin interfaceSelectable
-
getText
public String getText()
Description copied from interface:SelectableThe selectable's "canonical" text representation- Specified by:
getTextin interfaceSelectable
-
getCustomReadExpression
public String getCustomReadExpression()
Description copied from interface:SelectableAny custom read expression for this selectable. Only pertinent for physical columns (not formulas)- Specified by:
getCustomReadExpressionin interfaceSelectable- See Also:
ColumnTransformer
-
getCustomWriteExpression
public String getCustomWriteExpression()
Description copied from interface:SelectableAny custom write expression for this selectable. Only pertinent for physical columns (not formulas)- Specified by:
getCustomWriteExpressionin interfaceSelectable- See Also:
ColumnTransformer
-
getJdbcMapping
public JdbcMapping getJdbcMapping()
Description copied from interface:SqlExpressibleAnything that is expressible at the SQL AST level would be of basic type.- Specified by:
getJdbcMappingin interfaceSqlExpressible
-
applySqlSelections
public void applySqlSelections(DomainResultCreationState creationState)
Description copied from interface:DomainResultProducerUsed 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:
applySqlSelectionsin interfaceDomainResultProducer
-
forEachJdbcType
public int forEachJdbcType(int offset, IndexedConsumer<JdbcMapping> action)Description copied from interface:JdbcMappingContainerVisit each JdbcMapping starting from the given offset- Specified by:
forEachJdbcTypein interfaceJdbcMappingContainer
-
-